Skip to content

Commit

Permalink
Merge pull request #10 from oapi-codegen/chore/testutil
Browse files Browse the repository at this point in the history
Remove `testutil` dependency
  • Loading branch information
jamietanna authored Sep 12, 2023
2 parents 8ae8293 + 0401e7e commit e2633ee
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 51 deletions.
7 changes: 1 addition & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/oapi-codegen/iris-middleware
go 1.20

require (
github.com/deepmap/oapi-codegen v1.14.0
github.com/getkin/kin-openapi v0.118.0
github.com/kataras/iris/v12 v12.2.6-0.20230908161203-24ba4e8933b9
github.com/stretchr/testify v1.8.4
Expand Down Expand Up @@ -36,12 +35,8 @@ require (
github.com/kataras/sitemap v0.0.6 // indirect
github.com/kataras/tunnel v0.0.4 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/labstack/echo/v4 v4.11.1 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/mailgun/raymond/v2 v2.0.48 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/microcosm-cc/bluemonday v1.0.25 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/perimeterx/marshmallow v1.1.4 // indirect
Expand All @@ -51,8 +46,8 @@ require (
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/tdewolff/minify/v2 v2.12.9 // indirect
github.com/tdewolff/parse/v2 v2.6.8 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yosssi/ace v0.0.5 // indirect
Expand Down
22 changes: 1 addition & 21 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
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/deepmap/oapi-codegen v1.14.0 h1:b51/kQwH69rjN5pu+8j/Q5fUGD/rUclLAcGLQWQwa3E=
github.com/deepmap/oapi-codegen v1.14.0/go.mod h1:QcEpzjVDwJEH3Fq6I7XYkI0M/JwvoL82ToYveaeVMAw=
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
Expand Down Expand Up @@ -83,23 +81,14 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/labstack/echo/v4 v4.11.1 h1:dEpLU2FLg4UVmvCGPuk/APjlH6GDpbEPti61srUUUs4=
github.com/labstack/echo/v4 v4.11.1/go.mod h1:YuYRTSM3CHs2ybfrL8Px48bO6BAnYIN4l8wSTMP6BDQ=
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
github.com/mailgun/raymond/v2 v2.0.48 h1:5dmlB680ZkFG2RN/0lvTAghrSxIESeu9/2aeDqACtjw=
github.com/mailgun/raymond/v2 v2.0.48/go.mod h1:lsgvL50kgt1ylcFJYZiULi5fjPBkkhNfj4KA0W54Z18=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/microcosm-cc/bluemonday v1.0.25 h1:4NEwSfiJ+Wva0VxN5B8OwMicaJvD8r9tlJWm9rtloEg=
github.com/microcosm-cc/bluemonday v1.0.25/go.mod h1:ZIOjCQp1OrzBBPIJmfX4qDYFuhU02nx4bn030ixfHLE=
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
Expand Down Expand Up @@ -136,15 +125,12 @@ github.com/tdewolff/parse/v2 v2.6.8 h1:mhNZXYCx//xG7Yq2e/kVLNZw4YfYmeHbhx+Zc0OvF
github.com/tdewolff/parse/v2 v2.6.8/go.mod h1:XHDhaU6IBgsryfdnpzUXBlT6leW/l25yrFBTEb4eIyM=
github.com/tdewolff/test v1.0.9 h1:SswqJCmeN4B+9gEAi/5uqT0qpi1y2/2O47V/1hhGZT0=
github.com/tdewolff/test v1.0.9/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo=
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU=
github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
Expand Down Expand Up @@ -176,12 +162,7 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand Down Expand Up @@ -215,7 +196,6 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
75 changes: 51 additions & 24 deletions oapi_validate_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package irismiddleware

import (
"bytes"
"context"
_ "embed"
"encoding/json"
"errors"
"fmt"
"io"
Expand All @@ -11,7 +13,6 @@ import (
"net/url"
"testing"

"github.com/deepmap/oapi-codegen/pkg/testutil"
"github.com/getkin/kin-openapi/openapi3"
"github.com/getkin/kin-openapi/openapi3filter"
"github.com/kataras/iris/v12"
Expand All @@ -28,8 +29,18 @@ func doGet(t *testing.T, i *iris.Application, rawURL string) *httptest.ResponseR
t.Fatalf("Invalid url: %s", rawURL)
}

response := testutil.NewRequest().Get(u.RequestURI()).WithHost(u.Host).WithAcceptJson().GoWithHTTPHandler(t, i)
return response.Recorder
r, err := http.NewRequest(http.MethodGet, u.String(), nil)
if err != nil {
t.Fatalf("Could not construct a request: %s", rawURL)
}
r.Header.Set("accept", "application/json")
r.Header.Set("host", u.Host)

tt := httptest.NewRecorder()

i.ServeHTTP(tt, r)

return tt
}

func doPost(t *testing.T, i *iris.Application, rawURL string, jsonBody interface{}) *httptest.ResponseRecorder {
Expand All @@ -38,8 +49,24 @@ func doPost(t *testing.T, i *iris.Application, rawURL string, jsonBody interface
t.Fatalf("Invalid url: %s", rawURL)
}

response := testutil.NewRequest().Post(u.RequestURI()).WithHost(u.Host).WithJsonBody(jsonBody).GoWithHTTPHandler(t, i)
return response.Recorder
body, err := json.Marshal(jsonBody)
if err != nil {
t.Fatalf("Could not marshal request body: %v", err)
}

r, err := http.NewRequest(http.MethodPost, u.String(), bytes.NewReader(body))
if err != nil {
t.Fatalf("Could not construct a request for URL %s: %v", rawURL, err)
}
r.Header.Set("accept", "application/json")
r.Header.Set("content-type", "application/json")
r.Header.Set("host", u.Host)

tt := httptest.NewRecorder()

i.ServeHTTP(tt, r)

return tt
}

func TestOapiRequestValidator(t *testing.T) {
Expand Down Expand Up @@ -115,30 +142,30 @@ func TestOapiRequestValidator(t *testing.T) {

// Let's send the request to the wrong server, this should fail validation
{
res := doGet(t, i, "https://not.deepmap.ai/resource")
res := doGet(t, i, "http://not.deepmap.ai/resource")
assert.Equal(t, http.StatusBadRequest, res.Code)
assert.False(t, called, "Handler should not have been called")
}

// Let's send a good request, it should pass
{
res := doGet(t, i, "https://deepmap.ai/resource")
res := doGet(t, i, "http://deepmap.ai/resource")
assert.Equal(t, http.StatusOK, res.Code)
assert.True(t, called, "Handler should have been called")
called = false
}

// Send an out-of-spec parameter
{
res := doGet(t, i, "https://deepmap.ai/resource?id=500")
res := doGet(t, i, "http://deepmap.ai/resource?id=500")
assert.Equal(t, http.StatusBadRequest, res.Code)
assert.False(t, called, "Handler should not have been called")
called = false
}

// Send a bad parameter type
{
res := doGet(t, i, "https://deepmap.ai/resource?id=foo")
res := doGet(t, i, "http://deepmap.ai/resource?id=foo")
assert.Equal(t, http.StatusBadRequest, res.Code)
assert.False(t, called, "Handler should not have been called")
called = false
Expand All @@ -152,7 +179,7 @@ func TestOapiRequestValidator(t *testing.T) {
}{
Name: "Marcin",
}
res := doPost(t, i, "https://deepmap.ai/resource", body)
res := doPost(t, i, "http://deepmap.ai/resource", body)
assert.Equal(t, http.StatusNoContent, res.Code)
assert.True(t, called, "Handler should have been called")
called = false
Expand All @@ -165,31 +192,31 @@ func TestOapiRequestValidator(t *testing.T) {
}{
Name: 7,
}
res := doPost(t, i, "https://deepmap.ai/resource", body)
res := doPost(t, i, "http://deepmap.ai/resource", body)
assert.Equal(t, http.StatusBadRequest, res.Code)
assert.False(t, called, "Handler should not have been called")
called = false
}

// Call a protected function to which we have access
{
res := doGet(t, i, "https://deepmap.ai/protected_resource")
res := doGet(t, i, "http://deepmap.ai/protected_resource")
assert.Equal(t, http.StatusNoContent, res.Code)
assert.True(t, called, "Handler should have been called")
called = false
}

// Call a protected function to which we don't have access
{
res := doGet(t, i, "https://deepmap.ai/protected_resource2")
res := doGet(t, i, "http://deepmap.ai/protected_resource2")
assert.Equal(t, http.StatusBadRequest, res.Code)
assert.False(t, called, "Handler should not have been called")
called = false
}

// Call a protected function without credentials
{
res := doGet(t, i, "https://deepmap.ai/protected_resource_401")
res := doGet(t, i, "http://deepmap.ai/protected_resource_401")
assert.Equal(t, http.StatusBadRequest, res.Code)
body, err := io.ReadAll(res.Body)
if assert.NoError(t, err) {
Expand Down Expand Up @@ -234,7 +261,7 @@ func TestOapiRequestValidatorWithOptionsMultiError(t *testing.T) {

// Let's send a good request, it should pass
{
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=50&id2=50")
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=50&id2=50")
assert.Equal(t, http.StatusOK, res.Code)
assert.True(t, called, "Handler should have been called")
called = false
Expand All @@ -243,7 +270,7 @@ func TestOapiRequestValidatorWithOptionsMultiError(t *testing.T) {
// Let's send a request with a missing parameter, it should return
// a bad status
{
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=50")
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=50")
assert.Equal(t, http.StatusBadRequest, res.Code)
body, err := io.ReadAll(res.Body)
if assert.NoError(t, err) {
Expand All @@ -258,7 +285,7 @@ func TestOapiRequestValidatorWithOptionsMultiError(t *testing.T) {
// Let's send a request with a 2 missing parameters, it should return
// a bad status
{
res := doGet(t, i, "https://deepmap.ai/multiparamresource")
res := doGet(t, i, "http://deepmap.ai/multiparamresource")
assert.Equal(t, http.StatusBadRequest, res.Code)
body, err := io.ReadAll(res.Body)
if assert.NoError(t, err) {
Expand All @@ -275,7 +302,7 @@ func TestOapiRequestValidatorWithOptionsMultiError(t *testing.T) {
// Let's send a request with a 1 missing parameter, and another outside
// or the parameters. It should return a bad status
{
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=500")
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=500")
assert.Equal(t, http.StatusBadRequest, res.Code)
body, err := io.ReadAll(res.Body)
if assert.NoError(t, err) {
Expand All @@ -292,7 +319,7 @@ func TestOapiRequestValidatorWithOptionsMultiError(t *testing.T) {
// Let's send a request with a parameters that do not meet spec. It should
// return a bad status
{
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=abc&id2=1")
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=abc&id2=1")
assert.Equal(t, http.StatusBadRequest, res.Code)
body, err := io.ReadAll(res.Body)
if assert.NoError(t, err) {
Expand Down Expand Up @@ -344,7 +371,7 @@ func TestOapiRequestValidatorWithOptionsMultiErrorAndCustomHandler(t *testing.T)

// Let's send a good request, it should pass
{
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=50&id2=50")
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=50&id2=50")
assert.Equal(t, http.StatusOK, res.Code)
assert.True(t, called, "Handler should have been called")
called = false
Expand All @@ -353,7 +380,7 @@ func TestOapiRequestValidatorWithOptionsMultiErrorAndCustomHandler(t *testing.T)
// Let's send a request with a missing parameter, it should return
// a bad status
{
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=50")
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=50")
assert.Equal(t, http.StatusBadRequest, res.Code)
body, err := io.ReadAll(res.Body)
if assert.NoError(t, err) {
Expand All @@ -368,7 +395,7 @@ func TestOapiRequestValidatorWithOptionsMultiErrorAndCustomHandler(t *testing.T)
// Let's send a request with a 2 missing parameters, it should return
// a bad status
{
res := doGet(t, i, "https://deepmap.ai/multiparamresource")
res := doGet(t, i, "http://deepmap.ai/multiparamresource")
assert.Equal(t, http.StatusBadRequest, res.Code)
body, err := io.ReadAll(res.Body)
if assert.NoError(t, err) {
Expand All @@ -385,7 +412,7 @@ func TestOapiRequestValidatorWithOptionsMultiErrorAndCustomHandler(t *testing.T)
// Let's send a request with a 1 missing parameter, and another outside
// or the parameters. It should return a bad status
{
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=500")
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=500")
assert.Equal(t, http.StatusBadRequest, res.Code)
body, err := io.ReadAll(res.Body)
if assert.NoError(t, err) {
Expand All @@ -402,7 +429,7 @@ func TestOapiRequestValidatorWithOptionsMultiErrorAndCustomHandler(t *testing.T)
// Let's send a request with a parameters that do not meet spec. It should
// return a bad status
{
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=abc&id2=1")
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=abc&id2=1")
assert.Equal(t, http.StatusBadRequest, res.Code)
body, err := io.ReadAll(res.Body)
if assert.NoError(t, err) {
Expand Down

0 comments on commit e2633ee

Please sign in to comment.