Merging upstream version 1.0.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
c8b00cb8af
commit
61133985ce
13 changed files with 86 additions and 43 deletions
|
@ -7,17 +7,17 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: docker-bookworm
|
runs-on: docker-global-bookworm
|
||||||
container:
|
container:
|
||||||
image: 'code.forgejo.org/oci/node:20-bookworm'
|
image: 'code.forgejo.org/oci/node:22-bookworm'
|
||||||
steps:
|
steps:
|
||||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||||
- uses: https://code.forgejo.org/actions/setup-go@v5
|
- uses: https://code.forgejo.org/actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: "go.mod"
|
go-version-file: "go.mod"
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
uses: https://github.com/golangci/golangci-lint-action@v6
|
uses: https://github.com/golangci/golangci-lint-action@v8
|
||||||
with:
|
with:
|
||||||
version: v1.61.0 # renovate: datasource=go depName=golangci-lint packageName=github.com/golangci/golangci-lint/cmd/golangci-lint
|
version: v2.1.6 # renovate: datasource=go depName=golangci-lint packageName=github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||||
- name: test
|
- name: test
|
||||||
run: go test -v ./...
|
run: go test -v ./...
|
||||||
|
|
41
.golangci.yaml
Normal file
41
.golangci.yaml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
version: "2"
|
||||||
|
linters:
|
||||||
|
default: none
|
||||||
|
enable:
|
||||||
|
- bidichk
|
||||||
|
- dupl
|
||||||
|
- errcheck
|
||||||
|
- forbidigo
|
||||||
|
- gocritic
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
- nakedret
|
||||||
|
- nolintlint
|
||||||
|
- revive
|
||||||
|
- staticcheck
|
||||||
|
- testifylint
|
||||||
|
- unconvert
|
||||||
|
- unparam
|
||||||
|
- unused
|
||||||
|
- wastedassign
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
presets:
|
||||||
|
- comments
|
||||||
|
- common-false-positives
|
||||||
|
- legacy
|
||||||
|
- std-error-handling
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
|
formatters:
|
||||||
|
enable:
|
||||||
|
- gofmt
|
||||||
|
- gofumpt
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
12
binding.go
12
binding.go
|
@ -464,22 +464,22 @@ VALIDATE_RULES:
|
||||||
break VALIDATE_RULES
|
break VALIDATE_RULES
|
||||||
}
|
}
|
||||||
case strings.HasPrefix(rule, "MinSize("):
|
case strings.HasPrefix(rule, "MinSize("):
|
||||||
min, _ := strconv.Atoi(rule[8 : len(rule)-1])
|
minSize, _ := strconv.Atoi(rule[8 : len(rule)-1])
|
||||||
if str, ok := fieldValue.(string); ok && utf8.RuneCountInString(str) < min {
|
if str, ok := fieldValue.(string); ok && utf8.RuneCountInString(str) < minSize {
|
||||||
errors.Add([]string{field.Name}, ERR_MIN_SIZE, "MinSize")
|
errors.Add([]string{field.Name}, ERR_MIN_SIZE, "MinSize")
|
||||||
break VALIDATE_RULES
|
break VALIDATE_RULES
|
||||||
}
|
}
|
||||||
if fieldVal.Kind() == reflect.Slice && fieldVal.Len() < min {
|
if fieldVal.Kind() == reflect.Slice && fieldVal.Len() < minSize {
|
||||||
errors.Add([]string{field.Name}, ERR_MIN_SIZE, "MinSize")
|
errors.Add([]string{field.Name}, ERR_MIN_SIZE, "MinSize")
|
||||||
break VALIDATE_RULES
|
break VALIDATE_RULES
|
||||||
}
|
}
|
||||||
case strings.HasPrefix(rule, "MaxSize("):
|
case strings.HasPrefix(rule, "MaxSize("):
|
||||||
max, _ := strconv.Atoi(rule[8 : len(rule)-1])
|
maxSize, _ := strconv.Atoi(rule[8 : len(rule)-1])
|
||||||
if str, ok := fieldValue.(string); ok && utf8.RuneCountInString(str) > max {
|
if str, ok := fieldValue.(string); ok && utf8.RuneCountInString(str) > maxSize {
|
||||||
errors.Add([]string{field.Name}, ERR_MAX_SIZE, "MaxSize")
|
errors.Add([]string{field.Name}, ERR_MAX_SIZE, "MaxSize")
|
||||||
break VALIDATE_RULES
|
break VALIDATE_RULES
|
||||||
}
|
}
|
||||||
if fieldVal.Kind() == reflect.Slice && fieldVal.Len() > max {
|
if fieldVal.Kind() == reflect.Slice && fieldVal.Len() > maxSize {
|
||||||
errors.Add([]string{field.Name}, ERR_MAX_SIZE, "MaxSize")
|
errors.Add([]string{field.Name}, ERR_MAX_SIZE, "MaxSize")
|
||||||
break VALIDATE_RULES
|
break VALIDATE_RULES
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,12 +138,12 @@ func performErrorTest(t *testing.T, testCase errorTestCase) {
|
||||||
|
|
||||||
errorHandler(testCase.errors, resp)
|
errorHandler(testCase.errors, resp)
|
||||||
|
|
||||||
assert.EqualValues(t, testCase.expected.statusCode, resp.Code)
|
assert.Equal(t, testCase.expected.statusCode, resp.Code)
|
||||||
assert.EqualValues(t, testCase.expected.contentType, resp.Header().Get("Content-Type"))
|
assert.Equal(t, testCase.expected.contentType, resp.Header().Get("Content-Type"))
|
||||||
|
|
||||||
actualBody, err := io.ReadAll(resp.Body)
|
actualBody, err := io.ReadAll(resp.Body)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.EqualValues(t, testCase.expected.body, string(actualBody))
|
assert.Equal(t, testCase.expected.body, string(actualBody))
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
|
@ -35,11 +35,11 @@ func Test_ErrorsAdd(t *testing.T) {
|
||||||
actual.Add(expected[0].FieldNames, expected[0].Classification, expected[0].Message)
|
actual.Add(expected[0].FieldNames, expected[0].Classification, expected[0].Message)
|
||||||
|
|
||||||
assert.Len(t, actual, 1)
|
assert.Len(t, actual, 1)
|
||||||
assert.EqualValues(t, fmt.Sprintf("%#v", expected), fmt.Sprintf("%#v", actual))
|
assert.Equal(t, fmt.Sprintf("%#v", expected), fmt.Sprintf("%#v", actual))
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_ErrorsLen(t *testing.T) {
|
func Test_ErrorsLen(t *testing.T) {
|
||||||
assert.EqualValues(t, len(errorsTestSet), errorsTestSet.Len())
|
assert.Equal(t, len(errorsTestSet), errorsTestSet.Len())
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_ErrorsHas(t *testing.T) {
|
func Test_ErrorsHas(t *testing.T) {
|
||||||
|
@ -57,11 +57,11 @@ func Test_ErrorGetters(t *testing.T) {
|
||||||
fieldsActual := err.Fields()
|
fieldsActual := err.Fields()
|
||||||
|
|
||||||
assert.Len(t, fieldsActual, 2)
|
assert.Len(t, fieldsActual, 2)
|
||||||
assert.EqualValues(t, "field1", fieldsActual[0])
|
assert.Equal(t, "field1", fieldsActual[0])
|
||||||
assert.EqualValues(t, "field2", fieldsActual[1])
|
assert.Equal(t, "field2", fieldsActual[1])
|
||||||
|
|
||||||
assert.EqualValues(t, "ErrorClass", err.Kind())
|
assert.Equal(t, "ErrorClass", err.Kind())
|
||||||
assert.EqualValues(t, "The message", err.Error())
|
assert.Equal(t, "The message", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
var errorsTestSet = Errors{
|
var errorsTestSet = Errors{
|
||||||
|
|
|
@ -117,8 +117,8 @@ func assertFileAsExpected(t *testing.T, actual *multipart.FileHeader, expected *
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.EqualValues(t, expected.fileName, actual.Filename)
|
assert.Equal(t, expected.fileName, actual.Filename)
|
||||||
assert.EqualValues(t, expected.data, unpackFileHeaderData(actual))
|
assert.Equal(t, expected.data, unpackFileHeaderData(actual))
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildRequestWithFile(testCase fileTestCase) *http.Request {
|
func buildRequestWithFile(testCase fileTestCase) *http.Request {
|
||||||
|
|
10
form_test.go
10
form_test.go
|
@ -206,8 +206,8 @@ func performFormTest(t *testing.T, binder handlerFunc, testCase formTestCase) {
|
||||||
}
|
}
|
||||||
expString := fmt.Sprintf("%+v", testCase.expected)
|
expString := fmt.Sprintf("%+v", testCase.expected)
|
||||||
actString := fmt.Sprintf("%+v", actual)
|
actString := fmt.Sprintf("%+v", actual)
|
||||||
if actString != expString && !(testCase.deepEqual && reflect.DeepEqual(testCase.expected, actual)) {
|
if actString != expString && (!testCase.deepEqual || !reflect.DeepEqual(testCase.expected, actual)) {
|
||||||
assert.EqualValues(t, expString, actString)
|
assert.Equal(t, expString, actString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ func performFormTest(t *testing.T, binder handlerFunc, testCase formTestCase) {
|
||||||
m.Post(testRoute, func(_ http.ResponseWriter, req *http.Request) {
|
m.Post(testRoute, func(_ http.ResponseWriter, req *http.Request) {
|
||||||
var actual Post
|
var actual Post
|
||||||
errs := binder(req, &actual)
|
errs := binder(req, &actual)
|
||||||
assert.EqualValues(t, p.Title, actual.Title)
|
assert.Equal(t, p.Title, actual.Title)
|
||||||
formTestHandler(actual, errs)
|
formTestHandler(actual, errs)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -238,7 +238,7 @@ func performFormTest(t *testing.T, binder handlerFunc, testCase formTestCase) {
|
||||||
m.Post(testRoute, func(_ http.ResponseWriter, req *http.Request) {
|
m.Post(testRoute, func(_ http.ResponseWriter, req *http.Request) {
|
||||||
var actual BlogPost
|
var actual BlogPost
|
||||||
errs := binder(req, &actual)
|
errs := binder(req, &actual)
|
||||||
assert.EqualValues(t, p.Title, actual.Title)
|
assert.Equal(t, p.Title, actual.Title)
|
||||||
formTestHandler(actual, errs)
|
formTestHandler(actual, errs)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -323,7 +323,7 @@ func Test_Default(t *testing.T) {
|
||||||
m.Get("/", func(_ http.ResponseWriter, req *http.Request) {
|
m.Get("/", func(_ http.ResponseWriter, req *http.Request) {
|
||||||
var f defaultForm
|
var f defaultForm
|
||||||
Bind(req, &f)
|
Bind(req, &f)
|
||||||
assert.EqualValues(t, "hello world", f.Default)
|
assert.Equal(t, "hello world", f.Default)
|
||||||
})
|
})
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
req, err := http.NewRequest("GET", "/", nil)
|
req, err := http.NewRequest("GET", "/", nil)
|
||||||
|
|
8
go.mod
8
go.mod
|
@ -1,10 +1,12 @@
|
||||||
module code.forgejo.org/go-chi/binding
|
module code.forgejo.org/go-chi/binding
|
||||||
|
|
||||||
go 1.23
|
go 1.24
|
||||||
|
|
||||||
|
toolchain go1.24.3
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-chi/chi/v5 v5.1.0
|
github.com/go-chi/chi/v5 v5.2.1
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.10.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
|
8
go.sum
8
go.sum
|
@ -1,11 +1,11 @@
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw=
|
github.com/go-chi/chi/v5 v5.2.1 h1:KOIHODQj58PmL80G2Eak4WdvUzjSJSm0vG72crDCqb8=
|
||||||
github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
github.com/go-chi/chi/v5 v5.2.1/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
|
14
json_test.go
14
json_test.go
|
@ -146,7 +146,7 @@ func performJSONTest(t *testing.T, binder handlerFunc, testCase jsonTestCase) {
|
||||||
case "JSON":
|
case "JSON":
|
||||||
if testCase.shouldSucceedOnJSON {
|
if testCase.shouldSucceedOnJSON {
|
||||||
assert.Empty(t, errs, errs)
|
assert.Empty(t, errs, errs)
|
||||||
assert.EqualValues(t, fmt.Sprintf("%+v", testCase.expected), fmt.Sprintf("%+v", actual))
|
assert.Equal(t, fmt.Sprintf("%+v", testCase.expected), fmt.Sprintf("%+v", actual))
|
||||||
} else {
|
} else {
|
||||||
assert.NotEmpty(t, errs)
|
assert.NotEmpty(t, errs)
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ func performJSONTest(t *testing.T, binder handlerFunc, testCase jsonTestCase) {
|
||||||
assert.Empty(t, errs, errs)
|
assert.Empty(t, errs, errs)
|
||||||
} else {
|
} else {
|
||||||
assert.NotEmpty(t, errs)
|
assert.NotEmpty(t, errs)
|
||||||
assert.EqualValues(t, fmt.Sprintf("%+v", testCase.expected), fmt.Sprintf("%+v", actual))
|
assert.Equal(t, fmt.Sprintf("%+v", testCase.expected), fmt.Sprintf("%+v", actual))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ func performJSONTest(t *testing.T, binder handlerFunc, testCase jsonTestCase) {
|
||||||
var actual []Post
|
var actual []Post
|
||||||
errs := binder(req, &actual)
|
errs := binder(req, &actual)
|
||||||
for i, a := range actual {
|
for i, a := range actual {
|
||||||
assert.EqualValues(t, p[i].Title, a.Title)
|
assert.Equal(t, p[i].Title, a.Title)
|
||||||
jsonTestHandler(a, errs)
|
jsonTestHandler(a, errs)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -184,7 +184,7 @@ func performJSONTest(t *testing.T, binder handlerFunc, testCase jsonTestCase) {
|
||||||
m.Post(testRoute, func(_ http.ResponseWriter, req *http.Request) {
|
m.Post(testRoute, func(_ http.ResponseWriter, req *http.Request) {
|
||||||
var actual Post
|
var actual Post
|
||||||
errs := binder(req, &actual)
|
errs := binder(req, &actual)
|
||||||
assert.EqualValues(t, p.Title, actual.Title)
|
assert.Equal(t, p.Title, actual.Title)
|
||||||
jsonTestHandler(actual, errs)
|
jsonTestHandler(actual, errs)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -200,7 +200,7 @@ func performJSONTest(t *testing.T, binder handlerFunc, testCase jsonTestCase) {
|
||||||
m.Post(testRoute, func(_ http.ResponseWriter, req *http.Request) {
|
m.Post(testRoute, func(_ http.ResponseWriter, req *http.Request) {
|
||||||
var actual BlogPost
|
var actual BlogPost
|
||||||
errs := binder(req, &actual)
|
errs := binder(req, &actual)
|
||||||
assert.EqualValues(t, p.Title, actual.Title)
|
assert.Equal(t, p.Title, actual.Title)
|
||||||
jsonTestHandler(actual, errs)
|
jsonTestHandler(actual, errs)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -215,7 +215,7 @@ func performJSONTest(t *testing.T, binder handlerFunc, testCase jsonTestCase) {
|
||||||
m.Post(testRoute, func(_ http.ResponseWriter, req *http.Request) {
|
m.Post(testRoute, func(_ http.ResponseWriter, req *http.Request) {
|
||||||
var actual Group
|
var actual Group
|
||||||
errs := binder(req, &actual)
|
errs := binder(req, &actual)
|
||||||
assert.EqualValues(t, p.Name, actual.Name)
|
assert.Equal(t, p.Name, actual.Name)
|
||||||
jsonTestHandler(actual, errs)
|
jsonTestHandler(actual, errs)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -250,7 +250,7 @@ func performJSONTest(t *testing.T, binder handlerFunc, testCase jsonTestCase) {
|
||||||
if testCase.shouldSucceedOnJSON &&
|
if testCase.shouldSucceedOnJSON &&
|
||||||
httpRecorder.Code != http.StatusOK &&
|
httpRecorder.Code != http.StatusOK &&
|
||||||
!testCase.shouldFailOnBind {
|
!testCase.shouldFailOnBind {
|
||||||
assert.EqualValues(t, http.StatusOK, httpRecorder.Code)
|
assert.Equal(t, http.StatusOK, httpRecorder.Code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -63,7 +63,7 @@ func Test_SetWithProperType(t *testing.T) {
|
||||||
m.Post(testRoute, func(_ http.ResponseWriter, req *http.Request) {
|
m.Post(testRoute, func(_ http.ResponseWriter, req *http.Request) {
|
||||||
var actual Everything
|
var actual Everything
|
||||||
errs := Form(req, &actual)
|
errs := Form(req, &actual)
|
||||||
assert.EqualValues(t, fmt.Sprintf("%+v", expectedOutputs[key]), fmt.Sprintf("%+v", actual))
|
assert.Equal(t, fmt.Sprintf("%+v", expectedOutputs[key]), fmt.Sprintf("%+v", actual))
|
||||||
if key == "errorful" {
|
if key == "errorful" {
|
||||||
assert.Len(t, errs, 10)
|
assert.Len(t, errs, 10)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -90,7 +90,7 @@ func performMultipartFormTest(t *testing.T, binder handlerFunc, testCase multipa
|
||||||
} else if !testCase.shouldSucceed {
|
} else if !testCase.shouldSucceed {
|
||||||
assert.NotEmpty(t, errs)
|
assert.NotEmpty(t, errs)
|
||||||
}
|
}
|
||||||
assert.EqualValues(t, fmt.Sprintf("%+v", testCase.inputAndExpected), fmt.Sprintf("%+v", actual))
|
assert.Equal(t, fmt.Sprintf("%+v", testCase.inputAndExpected), fmt.Sprintf("%+v", actual))
|
||||||
})
|
})
|
||||||
|
|
||||||
multipartPayload, mpWriter := makeMultipartPayload(testCase)
|
multipartPayload, mpWriter := makeMultipartPayload(testCase)
|
||||||
|
|
|
@ -586,7 +586,7 @@ func performValidationTest(t *testing.T, testCase validationTestCase) {
|
||||||
|
|
||||||
m.Post(testRoute, func(_ http.ResponseWriter, req *http.Request) {
|
m.Post(testRoute, func(_ http.ResponseWriter, req *http.Request) {
|
||||||
actual := Validate(req, testCase.data)
|
actual := Validate(req, testCase.data)
|
||||||
assert.EqualValues(t, fmt.Sprintf("%+v", testCase.expectedErrors), fmt.Sprintf("%+v", actual), testCase.description)
|
assert.Equal(t, fmt.Sprintf("%+v", testCase.expectedErrors), fmt.Sprintf("%+v", actual), testCase.description)
|
||||||
})
|
})
|
||||||
|
|
||||||
req, err := http.NewRequest("POST", testRoute, nil)
|
req, err := http.NewRequest("POST", testRoute, nil)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue