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

Set response on the context #40

Merged
merged 4 commits into from Nov 19, 2017
Merged

Set response on the context #40

merged 4 commits into from Nov 19, 2017

Conversation

Knaackee
Copy link
Contributor

In apollo-link the raw-response is available in the context in order to e.g. access the response headers in a afterware.

Ive attached the response here too.

https://github.com/apollographql/apollo-link/blob/685b07dd024b2e97a0929ac841ba5e1d19aa042a/packages/apollo-link-http/src/httpLink.ts#L179

Copy link
Owner

@jaydenseric jaydenseric left a comment

Choose a reason for hiding this comment

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

Thanks 🙂

I'll look into merging this as soon as I can; it's a busy end to the week.

package.json Outdated
@@ -1,6 +1,6 @@
{
"name": "apollo-upload-client",
"version": "6.0.2",
"version": "6.0.3",
Copy link
Owner

Choose a reason for hiding this comment

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

Best to undo this; I'll update the changelog and version in a few places myself prior to a release.

src/index.mjs Outdated
@@ -66,6 +74,7 @@ export const createUploadLink = (
.then(response => {
if (!response.ok)
throw new Error(`${response.status} (${response.statusText})`)
operation.setContext({ response })
Copy link
Owner

Choose a reason for hiding this comment

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

This should come before the response check above. Otherwise if the response is not ok, the response will not be attached to the context like in apollo-link-http.

@jaydenseric jaydenseric changed the title attaching the raw response to the context for usage in order to ensur… Set response on the context Nov 19, 2017
@jaydenseric jaydenseric merged commit 5942df8 into jaydenseric:master Nov 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants