Forum Discussion

rock3r's avatar
rock3r
Occasional Visitor
5 years ago

Model missing Accept header

Hey there, I am modeling an API that does different things depending on the value, and presence, of an Accept header. I have it modeled as follows in the Swagger YAML, and it should be correct for as...
  • HKosova's avatar
    5 years ago

    An empty string "" is not a valid media type, so it's not allowed in response definitions.

     

    According to RFC 7231 section 5.3.2, no Accept header is equivalent to Accept: */*, so you can use the */* value to test this use case. If you specifically need to omit the Accept header entirely, you'll need to use cURL or Swagger Inspector to test such requests.