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

fix: resolve relative fetch urls against location #499

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

kettanaito
Copy link
Member

* for native `fetch` in JSDOM.
* @see https://github.com/mswjs/msw/issues/1625
*/
const resolvedInput =
Copy link
Member Author

Choose a reason for hiding this comment

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

My only concern is that this will force the relative request URL resolution even for environments where making a request to a relative URL is allowed (i.e. the browser).

* can be parsed into a `URL` instance.
* A substitute for `URL.canParse()` for Node.js 18.
*/
export function canParseUrl(url: string): boolean {
Copy link
Member Author

Choose a reason for hiding this comment

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

We should replace this with URL.canParse once Node.js 20 is the minimal version to use with MSW.

@kettanaito kettanaito merged commit f9193cd into main Jan 25, 2024
1 check passed
@kettanaito kettanaito deleted the fix/fetch-relative-url branch January 25, 2024 10:56
@kettanaito
Copy link
Member Author

Released: v0.25.15 🎉

This has been released in v0.25.15!

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.

Node interceptors don't resolve relative URLs when "location" is present
1 participant