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

feat(wip): async hooks interceptor #495

Closed
wants to merge 4 commits into from

Conversation

kettanaito
Copy link
Member

A proof of concept of using async_hooks for request interception. Quite interesting.

@kettanaito kettanaito marked this pull request as draft January 7, 2024 16:54

// Keep writing to the request body stream
// in case the body stream is still open.
message._write = (chunk, encoding, callback) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Reading request body is a pain.

@kettanaito
Copy link
Member Author

Good for reference, not good for production. Async hooks are awesome but they spread the context of a single request across multiple hooks, making it hard to write a consistent handling.

@kettanaito kettanaito closed this Apr 16, 2024
@kettanaito kettanaito deleted the feat/async-hooks-interceptor branch April 16, 2024 17:21
@kettanaito
Copy link
Member Author

Released: v0.32.0 🎉

This has been released in v0.32.0!

Make sure to always update to the latest version (npm i @mswjs/interceptors@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.

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

1 participant