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

Abort signal #169

Merged
merged 18 commits into from
May 20, 2020
Merged

Abort signal #169

merged 18 commits into from
May 20, 2020

Conversation

delvedor
Copy link
Member

I've added some initial testing, the first one never ends, while the fourth fails.

Closes: #164

@delvedor delvedor requested review from mcollina and ronag May 20, 2020 07:41
@ronag
Copy link
Member

ronag commented May 20, 2020

the first one never ends, while the fourth fails.

I will take a look. Can you also add docs?

We currently don't support https://www.npmjs.com/package/abort-controller. Do we want to?

@delvedor
Copy link
Member Author

delvedor commented May 20, 2020

I will take a look. Can you also add docs?

Yes, once I finish working on the tests :)

We currently don't support https://www.npmjs.com/package/abort-controller. Do we want to?

My plan is to support it and I already have some tests for it, but I would like to fix these ones before continuing.

test/abort.js Outdated Show resolved Hide resolved
test/abort.js Outdated Show resolved Hide resolved
@delvedor
Copy link
Member Author

@ronag @mcollina I've added the support for abort-controller, but the tests are failing, what am I missing? 🤔

@ronag
Copy link
Member

ronag commented May 20, 2020

I guess it's just the abort-controller tests? Have you confirmed addEventListener works as you expect?

@delvedor
Copy link
Member Author

delvedor commented May 20, 2020

@ronag found it, apparently using the option { once: true } never triggers the event 🤷‍♂️

Now all the tests are passing except for the first test of each file.

@delvedor delvedor marked this pull request as ready for review May 20, 2020 11:54
README.md Show resolved Hide resolved
@delvedor
Copy link
Member Author

I think this pr is now ready, @ronag @mcollina do you think we are still missing something?

Copy link
Member

@ronag ronag left a comment

Choose a reason for hiding this comment

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

LGTM once conflicts are resolved

lib/client.js Outdated Show resolved Hide resolved
@ronag
Copy link
Member

ronag commented May 20, 2020

Some of those setTimeouts seem unnecessary but I'm fine with landing it with those. @mcollina ?

setTimeout(() => {
res.setHeader('content-type', 'text/plain')
res.end('hello world')
}, 200)
Copy link
Member

Choose a reason for hiding this comment

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

Please remove all setTimeouts.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've removed most of the timeouts, the ones left are needed to simulate a slow response.

@mcollina
Copy link
Member

Agreed, no setTimeout

@delvedor delvedor requested a review from mcollina May 20, 2020 12:51
test/abort-controller.js Outdated Show resolved Hide resolved
test/abort-event-emitter.js Outdated Show resolved Hide resolved
@delvedor delvedor requested a review from ronag May 20, 2020 13:16
test/abort-event-emitter.js Outdated Show resolved Hide resolved
test/abort-event-emitter.js Outdated Show resolved Hide resolved
@ronag

This comment has been minimized.

test/abort-controller.js Outdated Show resolved Hide resolved
test/abort-controller.js Outdated Show resolved Hide resolved
@delvedor delvedor requested a review from ronag May 20, 2020 14:19
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@ronag ronag merged commit a9b59eb into master May 20, 2020
@ronag ronag deleted the abort-signal branch May 20, 2020 15:26
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.

Expose a simple API to abort requests
3 participants