-
-
Notifications
You must be signed in to change notification settings - Fork 365
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
fix: throw early if signal is aborted before request is triggered #663
Conversation
I tried to add a test for this scenario
here I am facing the following issue
seems like the |
I think the problem is that the Perhaps we should just copy the signal's state instead of using That way |
@sholladay I tried to copy the state of the original signal, but all abortController properties are readonly, not sure how to copy the state here. So I've aborted the internal abortController if the passed in signal was also aborted. The tests also seem to work with this usage. |
Yep, that's what I meant by copying the state. Could you also pass in the abort reason? Same as what's done in the event listener immediately below what you've written. |
Hey @sholladay , I've added the reason to the |
One last thing if you don't mind. I think it would be a good idea to fail the test if the server receives any requests. |
No issues @sholladay! I have modified the test to check if the server receives a request as well. Let me know if this looks good. |
Great work, @kadhirr. Thanks! |
ky does not seem to abort a request if the signal was aborted before the request was triggered (ref).
We fix this by calling the
throwIfAborted()
method on the original signal.