connexion icon indicating copy to clipboard operation
connexion copied to clipboard

Mock server doesn't respond with headers

Open alangibson-philips opened this issue 5 years ago • 2 comments

Description

When running in mock server mode with an OpenAPI 3 API definition, response headers aren't returned.

Expected behaviour

Headers defined in responses section should be included in response.

Actual behaviour

Only a few standard headers like Content-Type and Content-Length are included.

Steps to reproduce

  1. Add any header to an OpenAPI 3 response definition. Something like:
  /Endpoint:
    get:
      responses:
        '200':
          headers:
            cache-control:
              schema:
                type: string
                example: public
          content:
            application/json:
              ...
  1. Start connexion with connexion run your_api.yaml --mock=all
  2. Request the endpoint with an HTTP client, such as curl -v
  3. Observe that the header is not included in the response.

Additional info:

Output of the commands:

  • python --version Python 2.7.15rc1

  • pip show connexion | grep "^Version\:" Version: 2.2.0

alangibson-philips avatar Mar 01 '19 17:03 alangibson-philips

I see you added the enhancement tag to this issue. I'd be happy to look at putting together a pull request if you can point me in right direction. I haven't dug into this codebase before.

alangibson-philips avatar Mar 02 '19 07:03 alangibson-philips

Hi @alangibson-philips ,

I'm happy to hear you would be willing to send a PR. What kind of direction are you looking for? How could I help you?

rafaelcaricio avatar May 04 '19 14:05 rafaelcaricio