swaggest / rest

Web services with OpenAPI and JSON Schema done quick in Go
https://pkg.go.dev/github.com/swaggest/rest
MIT License
335 stars 17 forks source link

Invalid request body content types accepted by default #134

Closed pboguslawski closed 1 year ago

pboguslawski commented 1 year ago

Describe the bug According to https://github.com/swaggest/rest/issues/113 valid JSON Content-Type is application/json but swaggest accepts by default any value matching application/json* pattern, i.e.

application/json; charset=utf-8
application/json123

Expected behavior Only application/json should be allowed by default; allowing incorrect deviations like application/json; charset=utf-8 may be allowed only when explicitly requested (with option similar to existing tolerateFormData).

Additional context https://www.hyrumslaw.com/