Skip to content

Commit

Permalink
extend test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhailovavexmocom committed Dec 24, 2024
1 parent f04b5e8 commit ce98f41
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions openapi3filter/issue1045_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,37 @@ components:
shouldFail bool
}{
{
name: "json",
name: "json success",
endpoint: "/api/path",
ct: "application/json",
data: `{"msg":"message", "name":"some+name"}`,
shouldFail: false,
},
{
name: "json failure",
endpoint: "/api/path",
ct: "application/json",
data: `{"name":"some+name"}`,
shouldFail: true,
},

// application/x-www-form-urlencoded
{
name: "form",
name: "form success",
endpoint: "/api/path",
ct: "application/x-www-form-urlencoded",
data: "msg=message&name=some+name",
shouldFail: false,
},
{
name: "form failure",
endpoint: "/api/path",
ct: "application/x-www-form-urlencoded",
data: "name=some+name",
shouldFail: true,
},
} {
t.Run(testcase.ct, func(t *testing.T) {
t.Run(testcase.name, func(t *testing.T) {
data := strings.NewReader(testcase.data)
req, err := http.NewRequest("POST", testcase.endpoint, data)
require.NoError(t, err)
Expand Down

0 comments on commit ce98f41

Please sign in to comment.