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

Update to reset httpRepsonse.Body #6948

Merged
merged 2 commits into from
Aug 4, 2020

Conversation

nmische
Copy link
Contributor

@nmische nmische commented Jul 15, 2020

… such that is available to client consumers via the returned httpResponse variable.

@antihax @grokify @kemokemo @bkabrda

Addresses #4799

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/config/java*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

…nsumers via the returned httpResponse variable.
@nmische
Copy link
Contributor Author

nmische commented Jul 22, 2020

@antihax @grokify @kemokemo @bkabrda: Thoughts on this enhancement?

Also, I'm not sure what the problem is with the circleci build, so any help there would be appreciated.

@wing328 wing328 mentioned this pull request Jul 26, 2020
5 tasks
@wing328
Copy link
Member

wing328 commented Jul 28, 2020

@nmische I've fixed the CI failure by updating the samples.

I wonder if you can review #7041 as well since that PR seems to address similar issues.

@nmische
Copy link
Contributor Author

nmische commented Jul 29, 2020

@wing328: Thank you for the help with the CircleCI build!

I see a few challenges with #7041. First it doesn't really address the issue this PR seeks to address, which is that the returned response.Body can't be used to read the raw API response with the currently generated client. In #7041 this still appears to be an issue, while this PR re-sets the response.Body such that it can be re-read to access the raw response. (This can be very useful when debugging scenarios where the upstream API has returned malformed JSON.)

Second, #7041 changes the generated client's API in that it requires the caller to ensure they close the request body. With the currently generated client, and the update proposed in this PR, closing the request body is done by the generated client code. Thus users could update to the client generated by the templates in this PR and not have to change any of their existing code.

@wing328 wing328 added this to the 5.0.0 milestone Jul 30, 2020
@gmtstephane
Copy link
Contributor

I agree, this PR is more appropriate than my own #7041

@wing328 wing328 changed the title Update to reset httpRepsonse.Body … Update to reset httpRepsonse.Body Aug 4, 2020
@wing328 wing328 merged commit b8e87bb into OpenAPITools:master Aug 4, 2020
@wing328
Copy link
Member

wing328 commented Aug 4, 2020

@gmtstephane thanks for the review

@nmische thanks for the PR, which has been merged into master.

When you've time, I wonder if you can make the same enhancement to the go-experimental client generator:

@nmische
Copy link
Contributor Author

nmische commented Aug 5, 2020

@wing328: I'm happy to update the go-experimental client generator as well. I should be able to get to that later this week or early next.

jimschubert added a commit that referenced this pull request Aug 12, 2020
* master: (129 commits)
  [typescript-axios] add promise to bearer and oauth tokens (#7132)
  update doc
  [REQ] Added enumClassPrefix option to Go server generation (#7008)
  [Java][jersey2] Add helper methods for oneOf Java classes (#7115)
  [Kotlin][Retrofit2] fix missing import for file (#7121)
  adding handling for epoch dates in javascript ApiClient mustache file (#6497) (#6504)
  update doc
  comment out cpanm in travis
  [Kotlin] Rxjava3 support (#6998)
  [BUG][JAVA] Fix error handling in okhttp-gson async api client (#7089)
  Update to reset httpRepsonse.Body (#6948)
  [php-lumen] Set required PHP version to ^7.2.5 (#6949)
  [contrib][docs] Assert importance of title/description/repro steps (#7103)
  ISSUE-4222: Prevent conflicts with accept(s) local variables in generated Java RestTemplate ApiClient (#7101)
  [bug][core] Copy all attributes (not properties) on composed schemas when flattening models (#7106)
  [core] Add type and format properties to model of inline response (#6153)
  [PowerShell] better publishing workflow (#7114)
  [aspnetcore] Typo issues in docs and generated code (#7094)
  fix http signaure auth in build.sbt (#7110)
  fix for the issue facing spec invlolving arrayschema structure with ref (#6310)
  ...
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.

None yet

3 participants