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

Drop request parsing from "onUnhandledRequest" #1983

Closed
1 task
kettanaito opened this issue Jan 20, 2024 · 2 comments · Fixed by #1990
Closed
1 task

Drop request parsing from "onUnhandledRequest" #1983

kettanaito opened this issue Jan 20, 2024 · 2 comments · Fixed by #1990
Assignees
Milestone

Comments

@kettanaito
Copy link
Member

Scope

Improves an existing behavior

Compatibility

  • This is a breaking change

Feature description

Right now, we parse any unhandled request just to see if it's not a GraphQL request. We do that to provide a bit better developer experience by including the operation type and name in the unhandled request warning message.

However, because of this, everybody ends up with all GraphQL dependencies even if they are not mocking anything GraphQL related. This has also been reported to end up with a lot of additional modules imported when using MSW (by @thepassle).

Solution

  • Remove request parsing from onUnhandledRequest at all.
  • Log out request method and path. This is sufficient to help the developer debug what's unmatched.
  • In the future, we can log out the request initiator, once we implement it (Show unhandled request's initiator #1764)
@kettanaito
Copy link
Member Author

As a part of this change, we may also consider doing #1599 to gain an even bigger performance boost for unhandled requests.

@kettanaito
Copy link
Member Author

Released: v2.1.4 🎉

This has been released in v2.1.4!

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


Predictable release automation by @ossjs/release.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant