Skip to content

Consumes */* in OpenAPI breaks Swagger UI #6742

Open
@zerodayz

Description

@zerodayz

Consumes set to / in OpenAPI spec, breaks swagger ui request.

For example in Kubernetes:

curl -X DELETE "HOST/api/v1/namespaces/test-namespace/pods/test-pod?propagationPolicy=Background" -H "accept: application/json" -H "Content-Type: /" -d "{ "propagationPolicy": "Background"}"

breaks in app because it takes / literally, instead you should be able to choose from:

  • application/json
  • application/yaml
  • application/vnd.kubernetes.protobuf

Such curl requests will results in:

"message": "the body of the request was in an unknown format - accepted media types include: application/json, application/yaml, application/vnd.kubernetes.protobuf",
"reason": "UnsupportedMediaType",

Is there a way to add custom content-types when / is matched?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions