-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
unsupported media type for "application/json; charset=utf-8" #124
Comments
@Mk811 i agree, the raw should be used. a PR is greatly appreciated! The syntax is as such:
we should fall back to the |
@cdimascio Sounds great. Thank you for the quick reply. To sum up, if the Does it sound good for you? |
Yes, that sounds good. |
@Mk811 how are you making out? If u have any questions or want to discuss more freely, feel free to join us on gitter. https://gitter.im/cdimascio-oss/community |
fix available in |
Hi, my company has a rule that we mandatory set
Content-Type: application.json; charset=utf-8
to all the request/response header. (I know thecharset=utf-8
is probably redundant for json though.)Since OpenAPI Validator drop charactors of Content-Type after the charactor of
;
as below, our OpenAPI Validator cannot find the appropriate request body schema and respondunsupported media type application/json
.express-openapi-validator/src/middlewares/util.ts
Lines 6 to 17 in 04a84e5
Sample api spec is described as below. Due to the issue above, requests which has
Content-Type: application.json; charset=utf-8
cannot be associated with the schema$ref: '#/components/schemas/user'
.I think we should use original raw value of
Content-Type
in request header to find appropriate schema.express-openapi-validator/src/middlewares/openapi.request.validator.ts
Line 196 in 04a84e5
If you feel okay with my suggestion, let me create PR.
The text was updated successfully, but these errors were encountered: