Skip to content

Add DefaultContentType to OpenApiReaderSettings #1336

Closed

Description

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.

Activity

  1. darrelmiller commented on Sep 11, 2023

    @darrelmiller
    Member

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

  2. darrelmiller commented on Sep 19, 2023

    @darrelmiller
    Member

    Luc Genetier (@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?

  3. LucGenetier commented on Sep 19, 2023

    @LucGenetier
    ContributorAuthor

    Darrel (@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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions