Forum Discussion

ifernan's avatar
ifernan
Occasional Contributor
7 years ago

Is it possible to set an example for output header?

Hi.   First of all. I am using specification '2.0'. I want to set a value for a response header to be returned for AutoMocking API. I have tried different approaches and this is the last one: ...
  • HKosova's avatar
    7 years ago

    Hi ifernan,

     

    Response headers support the example keyword in OpenAPI 3.0 but not in OpenAPI 2.0. You'll need to convert you API definition to OpenAPI 3.0 to be able to specify example values for response headers.

    openapi: '3.0.0'
    ...
    
          responses:
            '200':
              description: OK
              headers:
                own-response-header:
                  description: own-response-header
                  schema:
                    type: string
                  example: "123"