Skip to content

Commit e2633ee

Browse files
authored
Merge pull request #10 from oapi-codegen/chore/testutil
Remove `testutil` dependency
2 parents 8ae8293 + 0401e7e commit e2633ee

File tree

3 files changed

+53
-51
lines changed

3 files changed

+53
-51
lines changed

go.mod

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module github.com/oapi-codegen/iris-middleware
33
go 1.20
44

55
require (
6-
github.com/deepmap/oapi-codegen v1.14.0
76
github.com/getkin/kin-openapi v0.118.0
87
github.com/kataras/iris/v12 v12.2.6-0.20230908161203-24ba4e8933b9
98
github.com/stretchr/testify v1.8.4
@@ -36,12 +35,8 @@ require (
3635
github.com/kataras/sitemap v0.0.6 // indirect
3736
github.com/kataras/tunnel v0.0.4 // indirect
3837
github.com/klauspost/compress v1.16.7 // indirect
39-
github.com/labstack/echo/v4 v4.11.1 // indirect
40-
github.com/labstack/gommon v0.4.0 // indirect
4138
github.com/mailgun/raymond/v2 v2.0.48 // indirect
4239
github.com/mailru/easyjson v0.7.7 // indirect
43-
github.com/mattn/go-colorable v0.1.13 // indirect
44-
github.com/mattn/go-isatty v0.0.19 // indirect
4540
github.com/microcosm-cc/bluemonday v1.0.25 // indirect
4641
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
4742
github.com/perimeterx/marshmallow v1.1.4 // indirect
@@ -51,8 +46,8 @@ require (
5146
github.com/sirupsen/logrus v1.8.1 // indirect
5247
github.com/tdewolff/minify/v2 v2.12.9 // indirect
5348
github.com/tdewolff/parse/v2 v2.6.8 // indirect
49+
github.com/ugorji/go/codec v1.2.11 // indirect
5450
github.com/valyala/bytebufferpool v1.0.0 // indirect
55-
github.com/valyala/fasttemplate v1.2.2 // indirect
5651
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
5752
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
5853
github.com/yosssi/ace v0.0.5 // indirect

go.sum

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
1919
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2020
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2121
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
22-
github.com/deepmap/oapi-codegen v1.14.0 h1:b51/kQwH69rjN5pu+8j/Q5fUGD/rUclLAcGLQWQwa3E=
23-
github.com/deepmap/oapi-codegen v1.14.0/go.mod h1:QcEpzjVDwJEH3Fq6I7XYkI0M/JwvoL82ToYveaeVMAw=
2422
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
2523
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
2624
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
@@ -83,23 +81,14 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
8381
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
8482
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
8583
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
86-
github.com/labstack/echo/v4 v4.11.1 h1:dEpLU2FLg4UVmvCGPuk/APjlH6GDpbEPti61srUUUs4=
87-
github.com/labstack/echo/v4 v4.11.1/go.mod h1:YuYRTSM3CHs2ybfrL8Px48bO6BAnYIN4l8wSTMP6BDQ=
88-
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
89-
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
9084
github.com/mailgun/raymond/v2 v2.0.48 h1:5dmlB680ZkFG2RN/0lvTAghrSxIESeu9/2aeDqACtjw=
9185
github.com/mailgun/raymond/v2 v2.0.48/go.mod h1:lsgvL50kgt1ylcFJYZiULi5fjPBkkhNfj4KA0W54Z18=
9286
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
9387
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
9488
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
9589
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
96-
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
9790
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
98-
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
99-
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
100-
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
10191
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
102-
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
10392
github.com/microcosm-cc/bluemonday v1.0.25 h1:4NEwSfiJ+Wva0VxN5B8OwMicaJvD8r9tlJWm9rtloEg=
10493
github.com/microcosm-cc/bluemonday v1.0.25/go.mod h1:ZIOjCQp1OrzBBPIJmfX4qDYFuhU02nx4bn030ixfHLE=
10594
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
@@ -136,15 +125,12 @@ github.com/tdewolff/parse/v2 v2.6.8 h1:mhNZXYCx//xG7Yq2e/kVLNZw4YfYmeHbhx+Zc0OvF
136125
github.com/tdewolff/parse/v2 v2.6.8/go.mod h1:XHDhaU6IBgsryfdnpzUXBlT6leW/l25yrFBTEb4eIyM=
137126
github.com/tdewolff/test v1.0.9 h1:SswqJCmeN4B+9gEAi/5uqT0qpi1y2/2O47V/1hhGZT0=
138127
github.com/tdewolff/test v1.0.9/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
139-
github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo=
140128
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
141129
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
142130
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
131+
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
143132
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
144133
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
145-
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
146-
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
147-
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
148134
github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU=
149135
github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
150136
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
@@ -176,12 +162,7 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
176162
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
177163
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
178164
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
179-
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
180-
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
181165
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
182-
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
183-
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
184-
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
185166
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
186167
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
187168
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -215,7 +196,6 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
215196
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
216197
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
217198
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
218-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
219199
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
220200
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
221201
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

oapi_validate_test.go

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package irismiddleware
22

33
import (
4+
"bytes"
45
"context"
56
_ "embed"
7+
"encoding/json"
68
"errors"
79
"fmt"
810
"io"
@@ -11,7 +13,6 @@ import (
1113
"net/url"
1214
"testing"
1315

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

31-
response := testutil.NewRequest().Get(u.RequestURI()).WithHost(u.Host).WithAcceptJson().GoWithHTTPHandler(t, i)
32-
return response.Recorder
32+
r, err := http.NewRequest(http.MethodGet, u.String(), nil)
33+
if err != nil {
34+
t.Fatalf("Could not construct a request: %s", rawURL)
35+
}
36+
r.Header.Set("accept", "application/json")
37+
r.Header.Set("host", u.Host)
38+
39+
tt := httptest.NewRecorder()
40+
41+
i.ServeHTTP(tt, r)
42+
43+
return tt
3344
}
3445

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

41-
response := testutil.NewRequest().Post(u.RequestURI()).WithHost(u.Host).WithJsonBody(jsonBody).GoWithHTTPHandler(t, i)
42-
return response.Recorder
52+
body, err := json.Marshal(jsonBody)
53+
if err != nil {
54+
t.Fatalf("Could not marshal request body: %v", err)
55+
}
56+
57+
r, err := http.NewRequest(http.MethodPost, u.String(), bytes.NewReader(body))
58+
if err != nil {
59+
t.Fatalf("Could not construct a request for URL %s: %v", rawURL, err)
60+
}
61+
r.Header.Set("accept", "application/json")
62+
r.Header.Set("content-type", "application/json")
63+
r.Header.Set("host", u.Host)
64+
65+
tt := httptest.NewRecorder()
66+
67+
i.ServeHTTP(tt, r)
68+
69+
return tt
4370
}
4471

4572
func TestOapiRequestValidator(t *testing.T) {
@@ -115,30 +142,30 @@ func TestOapiRequestValidator(t *testing.T) {
115142

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

123150
// Let's send a good request, it should pass
124151
{
125-
res := doGet(t, i, "https://deepmap.ai/resource")
152+
res := doGet(t, i, "http://deepmap.ai/resource")
126153
assert.Equal(t, http.StatusOK, res.Code)
127154
assert.True(t, called, "Handler should have been called")
128155
called = false
129156
}
130157

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

139166
// Send a bad parameter type
140167
{
141-
res := doGet(t, i, "https://deepmap.ai/resource?id=foo")
168+
res := doGet(t, i, "http://deepmap.ai/resource?id=foo")
142169
assert.Equal(t, http.StatusBadRequest, res.Code)
143170
assert.False(t, called, "Handler should not have been called")
144171
called = false
@@ -152,7 +179,7 @@ func TestOapiRequestValidator(t *testing.T) {
152179
}{
153180
Name: "Marcin",
154181
}
155-
res := doPost(t, i, "https://deepmap.ai/resource", body)
182+
res := doPost(t, i, "http://deepmap.ai/resource", body)
156183
assert.Equal(t, http.StatusNoContent, res.Code)
157184
assert.True(t, called, "Handler should have been called")
158185
called = false
@@ -165,31 +192,31 @@ func TestOapiRequestValidator(t *testing.T) {
165192
}{
166193
Name: 7,
167194
}
168-
res := doPost(t, i, "https://deepmap.ai/resource", body)
195+
res := doPost(t, i, "http://deepmap.ai/resource", body)
169196
assert.Equal(t, http.StatusBadRequest, res.Code)
170197
assert.False(t, called, "Handler should not have been called")
171198
called = false
172199
}
173200

174201
// Call a protected function to which we have access
175202
{
176-
res := doGet(t, i, "https://deepmap.ai/protected_resource")
203+
res := doGet(t, i, "http://deepmap.ai/protected_resource")
177204
assert.Equal(t, http.StatusNoContent, res.Code)
178205
assert.True(t, called, "Handler should have been called")
179206
called = false
180207
}
181208

182209
// Call a protected function to which we don't have access
183210
{
184-
res := doGet(t, i, "https://deepmap.ai/protected_resource2")
211+
res := doGet(t, i, "http://deepmap.ai/protected_resource2")
185212
assert.Equal(t, http.StatusBadRequest, res.Code)
186213
assert.False(t, called, "Handler should not have been called")
187214
called = false
188215
}
189216

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

235262
// Let's send a good request, it should pass
236263
{
237-
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=50&id2=50")
264+
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=50&id2=50")
238265
assert.Equal(t, http.StatusOK, res.Code)
239266
assert.True(t, called, "Handler should have been called")
240267
called = false
@@ -243,7 +270,7 @@ func TestOapiRequestValidatorWithOptionsMultiError(t *testing.T) {
243270
// Let's send a request with a missing parameter, it should return
244271
// a bad status
245272
{
246-
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=50")
273+
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=50")
247274
assert.Equal(t, http.StatusBadRequest, res.Code)
248275
body, err := io.ReadAll(res.Body)
249276
if assert.NoError(t, err) {
@@ -258,7 +285,7 @@ func TestOapiRequestValidatorWithOptionsMultiError(t *testing.T) {
258285
// Let's send a request with a 2 missing parameters, it should return
259286
// a bad status
260287
{
261-
res := doGet(t, i, "https://deepmap.ai/multiparamresource")
288+
res := doGet(t, i, "http://deepmap.ai/multiparamresource")
262289
assert.Equal(t, http.StatusBadRequest, res.Code)
263290
body, err := io.ReadAll(res.Body)
264291
if assert.NoError(t, err) {
@@ -275,7 +302,7 @@ func TestOapiRequestValidatorWithOptionsMultiError(t *testing.T) {
275302
// Let's send a request with a 1 missing parameter, and another outside
276303
// or the parameters. It should return a bad status
277304
{
278-
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=500")
305+
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=500")
279306
assert.Equal(t, http.StatusBadRequest, res.Code)
280307
body, err := io.ReadAll(res.Body)
281308
if assert.NoError(t, err) {
@@ -292,7 +319,7 @@ func TestOapiRequestValidatorWithOptionsMultiError(t *testing.T) {
292319
// Let's send a request with a parameters that do not meet spec. It should
293320
// return a bad status
294321
{
295-
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=abc&id2=1")
322+
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=abc&id2=1")
296323
assert.Equal(t, http.StatusBadRequest, res.Code)
297324
body, err := io.ReadAll(res.Body)
298325
if assert.NoError(t, err) {
@@ -344,7 +371,7 @@ func TestOapiRequestValidatorWithOptionsMultiErrorAndCustomHandler(t *testing.T)
344371

345372
// Let's send a good request, it should pass
346373
{
347-
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=50&id2=50")
374+
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=50&id2=50")
348375
assert.Equal(t, http.StatusOK, res.Code)
349376
assert.True(t, called, "Handler should have been called")
350377
called = false
@@ -353,7 +380,7 @@ func TestOapiRequestValidatorWithOptionsMultiErrorAndCustomHandler(t *testing.T)
353380
// Let's send a request with a missing parameter, it should return
354381
// a bad status
355382
{
356-
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=50")
383+
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=50")
357384
assert.Equal(t, http.StatusBadRequest, res.Code)
358385
body, err := io.ReadAll(res.Body)
359386
if assert.NoError(t, err) {
@@ -368,7 +395,7 @@ func TestOapiRequestValidatorWithOptionsMultiErrorAndCustomHandler(t *testing.T)
368395
// Let's send a request with a 2 missing parameters, it should return
369396
// a bad status
370397
{
371-
res := doGet(t, i, "https://deepmap.ai/multiparamresource")
398+
res := doGet(t, i, "http://deepmap.ai/multiparamresource")
372399
assert.Equal(t, http.StatusBadRequest, res.Code)
373400
body, err := io.ReadAll(res.Body)
374401
if assert.NoError(t, err) {
@@ -385,7 +412,7 @@ func TestOapiRequestValidatorWithOptionsMultiErrorAndCustomHandler(t *testing.T)
385412
// Let's send a request with a 1 missing parameter, and another outside
386413
// or the parameters. It should return a bad status
387414
{
388-
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=500")
415+
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=500")
389416
assert.Equal(t, http.StatusBadRequest, res.Code)
390417
body, err := io.ReadAll(res.Body)
391418
if assert.NoError(t, err) {
@@ -402,7 +429,7 @@ func TestOapiRequestValidatorWithOptionsMultiErrorAndCustomHandler(t *testing.T)
402429
// Let's send a request with a parameters that do not meet spec. It should
403430
// return a bad status
404431
{
405-
res := doGet(t, i, "https://deepmap.ai/multiparamresource?id=abc&id2=1")
432+
res := doGet(t, i, "http://deepmap.ai/multiparamresource?id=abc&id2=1")
406433
assert.Equal(t, http.StatusBadRequest, res.Code)
407434
body, err := io.ReadAll(res.Body)
408435
if assert.NoError(t, err) {

0 commit comments

Comments
 (0)