Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cpp rest-sdk] Response headers handler #1511

Merged
merged 4 commits into from
Nov 23, 2018

Conversation

whoan
Copy link
Contributor

@whoan whoan commented Nov 21, 2018

PR checklist

  • Read the contribution guidelines.
  • 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\.
  • Filed the PR against the correct branch: master, 3.4.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Support processing the HTTP response headers through a handler that can be set in the ApiClient class.

Some APIs (like this) return useful information in the response headers, so this PR is to support processing them.

Ping @ravinikam @stkrwork @fvarose @etherealjoy @MartinDelille

@whoan whoan changed the title Reponse headers handler [cpp rest-sdk] Reponse headers handler Nov 21, 2018
@etherealjoy
Copy link
Contributor

What about error status? no need for headers there?

@whoan
Copy link
Contributor Author

whoan commented Nov 21, 2018

@etherealjoy If I understand your question(s), with the status code is not enough to get all the information some APIs send. As an example, the one I am using send information about remaining requests in the headers.

@etherealjoy
Copy link
Contributor

etherealjoy commented Nov 22, 2018

@whoan
It looks OK, but did you compile the sample code?

@etherealjoy If I understand your question(s), with the status code is not enough to get all the information some APIs send. As an example, the one I am using send information about remaining requests in the headers.

What I meant here if you want to invoke header handler callback when a 400 is received for example.

@whoan
Copy link
Contributor Author

whoan commented Nov 22, 2018

@ethanjcohen Yes, I compiled the code. Before the last commit I hadn't done, but now I did and it is working fine.

Regarding the status code, changing the handler signature to receive it would be a good improvement indeed. Do you want me to do it in this PR?

@etherealjoy
Copy link
Contributor

@whoan
You can do it later.

@etherealjoy etherealjoy added this to the 3.3.4 milestone Nov 23, 2018
@etherealjoy etherealjoy merged commit dd33434 into OpenAPITools:master Nov 23, 2018
@wing328 wing328 changed the title [cpp rest-sdk] Reponse headers handler [cpp rest-sdk] Response headers handler Nov 30, 2018
@wing328
Copy link
Member

wing328 commented Dec 4, 2018

@whoan thanks for the PR, which has been included in the v3.3.4 release: https://twitter.com/oas_generator/status/1068772409795207168

@whoan whoan deleted the reponse-headers-handler branch December 4, 2018 12:18
A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
* Add support to set a Response headers handler
* Update PetStore
* Fix missing names
* Update PetStore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants