-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
feat: implement a RequestController
class
#595
Conversation
3468754
to
d110b8a
Compare
d110b8a
to
073e3f2
Compare
Suspicious test
Not sure if this is intended. The test passes but the error looks weird. Need to check if it's intentional, and fix it if it's not. Edit: I confirm this doesn't happen on SolutionI incorrectly treated unhandled errors during request handling as aborted requests. While that may be so, that doesn't translate to request aborts as of now (we don't support aborting the request via The fix was to call |
RequestController
class
@@ -174,7 +174,7 @@ | |||
"@open-draft/logger": "^0.3.0", | |||
"@open-draft/until": "^2.0.0", | |||
"is-node-process": "^1.2.0", | |||
"outvariant": "^1.2.1", | |||
"outvariant": "^1.4.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outvariant
had issues with polymorphic errors and multiple positionals. Fixed it and updated the dependency.
Released: v0.33.0 🎉This has been released in v0.33.0! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
Warning
This is a breaking change. The way you handle requests changes from
request.respondWith()
tocontroller.respondWith()
.This change also lays foundation for supporting
controller.abort()
(or even better—useAbortSignal
) to abort any intercepted request. This would be awesome to ship in the future.Roadmap
utils/RequestController.ts
class. It's kind of similar but is used for a deferred response resolution. I suspect we can throw it away.request.respondWith()
.controller: RequestController
to the request event listener arguments.RequestController
respondWith
multiple calls tests from these unit testsonResponseError
andonAborted
scenarios (these were not supported previously and can be treated as a separate bugfix)