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: Dont' parse as json when status code is 204 No Content #2446

Merged
merged 6 commits into from
Apr 5, 2019

Conversation

bartverbruggen
Copy link
Contributor

No description provided.

@apollo-cla
Copy link

@bartverbruggen: 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/

@bartverbruggen
Copy link
Contributor Author

Any idea what could go wrong on the tests? It fails on tests I didn't even made changes on.. I've cleared cache etc...

@abernix
Copy link
Member

abernix commented Apr 4, 2019

Seems to be failing for potentially important reasons related to the change?

image

@bartverbruggen
Copy link
Contributor Author

@abernix How is that error related to my changes? Even after reverting all my edits, i still get those errors. Loosing it on this one..

I'll close this PR and create an issue, hoping that someone else can fix this small but vital issue.

@abernix
Copy link
Member

abernix commented Apr 4, 2019

I'm running the tests locally and I'm seeing the failures as well, however when I revert the two commits in this PR (i.e. git revert HEAD HEAD~), the tests pass again.

contentType &&
(contentType.startsWith('application/json') ||
contentType.startsWith('application/hal+json'))
response.status !== 204 ||
Copy link
Member

@abernix abernix Apr 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure you didn't mean to put this as an && inside the parenthesis that contain contentType.startsWith(...) || ...?

The failing tests are because of Content-type: text/plain and you're always short-circuiting when the response.status !== 204, which would be most all of the time, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is embarrassing..., it, indeed, should have been && instead of ||, it is not necessary to put it inside the parenthesis because it should pass all three conditions.

Thank you very much!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to be embarrassed. That's what failing tests and code-reviews are meant to help with. 😄

Thank you for the first-time contribution!

@abernix abernix added this to the Release 2.5.0 milestone Apr 5, 2019
@abernix abernix changed the base branch from master to release-2.5.0 April 5, 2019 14:00
abernix added a commit to ryandrewjohnson/apollo-server that referenced this pull request Apr 5, 2019
@abernix abernix merged commit aa7c2b8 into apollographql:release-2.5.0 Apr 5, 2019
abernix pushed a commit that referenced this pull request Apr 5, 2019
* add no-cache headers to PersistedQuery error responses

* fix defaultHeaders typo

* remove try/catch on hasPersistedQueryError replace with Array.isArray check

* Add CHANGELOG.md for #2446.
@abernix
Copy link
Member

abernix commented Apr 5, 2019

Thanks for this PR!

It's been published in [email protected] and is paired with an upcoming Apollo Server 2.5.0 release: [email protected]. Please try it out and report back if you've had any problems, or if it works properly!

@StevenVerbiest
Copy link

Fix seems to work. Great job!

@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