Open dikac opened 3 weeks ago
Describe the bug Content-Type: multipart/form-data; boundary=SOME-BOUNDARY would fail to parse when request tag contain formData and json
Content-Type: multipart/form-data; boundary=SOME-BOUNDARY
formData
json
type UserList struct { Page string `formData:"page" json:"page"` }
To Reproduce create a request struct with formData and json
send request with content type multipart/form-data with boundary
multipart/form-data
boundary
POST /users HTTP/1.1 Host: localhost:8234 User-Agent: insomnia/2023.3.0 Content-Type: multipart/form-data; boundary=X-INSOMNIA-BOUNDARY Accept: */* Content-Length: 98 --X-INSOMNIA-BOUNDARY Content-Disposition: form-data; name="page" A --X-INSOMNIA-BOUNDARY--
would give Response
< HTTP/1.1 400 Bad Request < Content-Length: 168 < Content-Type: application/json < Date: Thu, 06 Jun 2024 14:17:45 GMT
Expected behavior Data decoded successfully without error
Additional context problem seems to came from function checkJSONBodyContentType
function checkJSONBodyContentType
Hello, swaggest/openapi-go library does not provide any request decoding facilities, could you clarify your use case? How do you decode request and how openapi-go is related?
swaggest/openapi-go
openapi-go
Describe the bug
Content-Type: multipart/form-data; boundary=SOME-BOUNDARY
would fail to parse when request tag containformData
andjson
To Reproduce create a request struct with
formData
andjson
send request with content type
multipart/form-data
withboundary
would give Response
Expected behavior Data decoded successfully without error
Additional context problem seems to came from
function checkJSONBodyContentType