Skip to content

Add support for AbortController signal passed via context#296

Open
marioestrada wants to merge 2 commits intoapollographql:masterfrom
marioestrada:signal-restlink
Open

Add support for AbortController signal passed via context#296
marioestrada wants to merge 2 commits intoapollographql:masterfrom
marioestrada:signal-restlink

Conversation

@marioestrada
Copy link

Why

Resolves #251

Description

Adding a good unit test for the abort case was tricky because of the way it's handled in line 1389:

.catch(err => {
if (err.name === 'AbortError') return;
if (err.result && err.result.errors) {

So I added a unit test using setTimeout to test that the request never fulfills, but I know it's not a great pattern to test because it adds an artificial delay to completing the tests.

Test

npm test

@apollo-cla
Copy link

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

@TrevinAvery
Copy link

Duplicate of #302

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.

Add Support for Request cancellation

5 participants