kogosoftwarellc / open-api

A Monorepo of various packages to power OpenAPI in node
MIT License
895 stars 237 forks source link

Content-Type validation error. #715

Closed kacperfronc closed 3 years ago

kacperfronc commented 3 years ago

I have a problem using OpenApi module, my request has a custom header application/json;version=1. Both in api spec and in request, but I'm getting wrong media type, because in BodySchemaParser it calls contentType.equivalents() which returns application/json; version=1, with space after ';'.

It works alright if I change the header in spec to be application/json; version=1 with space after ';' but I cannot do that, I need this to work without space there.

equivalents method inutil.js considers version=1 to be a charset and adds a space there, which breaks the validation.

Even if that was a charset, it shouldn't assume that space has to be there, because it doesn't, plenty of apis don't put a space after ';'