Skip to content

Remove testutil dependency #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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