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

Add support for aborting a request using AbortSignal #205

Merged
merged 6 commits into from Jul 18, 2022

Conversation

segevfiner
Copy link
Contributor

This adds support for passing an AbortSignal. Adding support for ClientRequest.destroy & ClientRequest.setTimeout will require figuring out an appropriate change to the inject interface as it currently doesn't return such a pending request object but only has a callback or promise. Also note that such cancellation and timeouts should effect technically also effect the socket causing it to emit appropriate events and/or change state. But we aren't emulating much of the socket ATM.

Relates to #203

Checklist

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

@mcollina
Copy link
Member

@Fdawgs it seems CI is not running, could u take a look?

@Fdawgs
Copy link
Member

Fdawgs commented Jul 15, 2022

@Fdawgs it seems CI is not running, could u take a look?

I have no idea why @mcollina, this PR should have triggered it. 😕

Have tested the CI with both a direct PR in this repo (#206) and from a fork (#207) and they both triggered.

@segevfiner
Copy link
Contributor Author

Let me push a no-op amend and see if it triggers. Maybe GitHub glitched.

@Fdawgs
Copy link
Member

Fdawgs commented Jul 15, 2022

There we go, thanks @segevfiner!

@segevfiner
Copy link
Contributor Author

Derp. AbortController is not available on Node 14.x... I wonder how do we want to handle that...

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.

Maybe throw if those things are not available?

You can use { skip: !global.AbortController } to skipt the test.

README.md Outdated Show resolved Hide resolved
Co-authored-by: Matteo Collina <matteo.collina@gmail.com>
@mcollina
Copy link
Member

You'll need to ignore those lines from the code coverage.

@mcollina
Copy link
Member

this now conflicts with master

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

@mcollina mcollina merged commit f70243a into fastify:master Jul 18, 2022
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

3 participants