Skip to content
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

Add DefaultContentType to OpenApiReaderSettings #1336

Closed
LucGenetier opened this issue Sep 11, 2023 · 3 comments · Fixed by #1359
Closed

Add DefaultContentType to OpenApiReaderSettings #1336

LucGenetier opened this issue Sep 11, 2023 · 3 comments · Fixed by #1359
Assignees

Comments

@LucGenetier
Copy link
Contributor

Is your feature request related to a problem? Please describe.
You recently changes the default content type from 'application/json' to 'application/octet-stream' when it is not specified in the swagger/openapi file.

Describe the solution you'd like
Allow the external user to set the default content type he'd like to use.

Describe alternatives you've considered
I haven't found any alternative.

Additional context
RFC 9110, section 8.3 says (MAY is the important part)

A sender that generates a message containing content SHOULD generate a Content-Type header field in that message unless the intended media type of the enclosed representation is unknown to the sender. If a Content-Type header field is not present, the recipient MAY either assume a media type of "application/octet-stream" ([RFC2046], Section 4.5.1) or examine the data to determine its type.

@darrelmiller
Copy link
Member

I think we should be able to add this as a property on OpenApiReaderSettings.

@darrelmiller
Copy link
Member

@LucGenetier Our devs are deep in the 3.1 implementation, would you mind sending a PR to add this property to the OpenAPIReadersettings and we will get a release out?

@LucGenetier
Copy link
Contributor Author

@darrelmiller I just looked at the code and don't see how I could access OpenAPIReadersettings where we need to access it.
In ParseOperationWithEmptyProducesArraySetsResponseSchemaIfExists test, OpenApiReaderSettings is never used/its constructor never called (if I create one)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants