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

apollo-datasource-rest RESTDataSource does not handle HTTP 204 responses correctly #2606

Closed
wants to merge 10 commits into from

Conversation

dhm116
Copy link

@dhm116 dhm116 commented Apr 24, 2019

We noticed that the RESTDataSource.parseBody method was not handling HTTP 204 responses correctly in the event that a Content-Type: application/json header was being defined on the response.

This PR resolves that issue by inspecting the response.status to ensure that it is not 204 before attempting to process the response as JSON.

TODO:

  • Update CHANGELOG.md with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

@apollo-cla
Copy link

@dhm116: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

@jplock
Copy link

jplock commented Apr 25, 2019

We ran into this issue with an API behind AWS API Gateway where we were returning a 204 status code with no Content-Type response header. API Gateway seems to be adding a Content-Type: application/json response header if one isn't defined and we haven't yet figured out a way to disable that. To @dhm116's point, the Content-Length header value is properly being set to zero.

@dhm116
Copy link
Author

dhm116 commented Apr 25, 2019

I'll get the tests fixed up today!

@bartverbruggen
Copy link
Contributor

This is fixed in #2446

@dhm116 dhm116 closed this May 3, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants