Skip to content

Registering body decoder for wildard */* content-type #481

@EmilLaursen

Description

@EmilLaursen

This is similar to #473

except I want to accept any content-type:

/api/v1/srv/upload/kbl:
    post:
      tags:
        - srv
      summary: Upload xml file to process it.
      operationId: upload.file
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
                - file
              type: object
              properties:
                file:
                  type: string
                  format: binary
            encoding:
              file:
                contentType: "*/*"

If I use a request with content-type application/pdf in the file form field, I get the content type not supported "application/pdf" error. Registering a specific RegisterBodyDecoder for application/pdf will work, but I would like to register one on the wildcard */*

	openapi3filter.RegisterBodyDecoder("*/*", noopDecoder)

which accepts application/pdf and all other unknown media-types! Is this possible? I do not know which content-types I receive in advance, so I can not register a decoder for each one.

Metadata

Metadata

Assignees

No one assigned

    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