swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

feat(nodejs): add support for response headers

Open sandro97git opened this issue 8 years ago • 3 comments

PR checklist

  • [x] Read the contribution guidelines.
  • [x] Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • [x] Filed the PR against the correct branch: master for non-breaking changes and 3.0.0 branch for breaking (non-backward compatible) changes.

Description of the PR

Response headers defined in swagger file are returned by the nodejs server.

Closes #6424

Tested with the following yaml:

swagger: '2.0'
info:
  description: >-
    This is a sample server Petstore server.  You can find out more about    
    Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net,
    #swagger](http://swagger.io/irc/).      For this sample, you can use the api
    key `special-key` to test the authorization     filters.
  version: 1.0.0
  title: Swagger Petstore
  termsOfService: 'http://swagger.io/terms/'
  contact:
    email: [email protected]
  license:
    name: Apache 2.0
    url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
host: petstore.swagger.io
basePath: /v2
tags:
  - name: pet
    description: Everything about your Pets
    externalDocs:
      description: Find out more
      url: 'http://swagger.io'
schemes:
  - http
paths:
  /pet/responsewithheader:
    get:
      tags:
        - pet
      produces:
        - application/xml
        - application/json
      responses:
        '200':
          headers:
            MyHeader:
              type: string
              default: '*'
          description: successful operation
  /pet/response:
    get:
      tags:
        - pet
      produces:
        - application/xml
        - application/json
      responses:
        '200':
          description: successful operation

To test, the generated service has to be moved manually to service folder. (See #6443)

sandro97git avatar Sep 06 '17 16:09 sandro97git

@sandro97git sorry I've been pretty busy this week. I'll review this week and answer your questions.

wing328 avatar Sep 13 '17 16:09 wing328

Any news here? No problem if you're busy, just in case you forgot :smiley:

sandro97git avatar Oct 20 '17 10:10 sandro97git

Any news here? No problem if you're busy, just in case you forgot 😃

Sorry for the delay. Let me review this weekend and get back to you

wing328 avatar Oct 20 '17 14:10 wing328