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

docs: url without pathName on server listen #266

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

reslear
Copy link
Contributor

@reslear reslear commented Oct 25, 2023

request.url is string not URL constructor :)

I also added a useful example (like mswjs/msw#1636 (reply in thread)) so you don't have to search for it

@vercel
Copy link

vercel bot commented Oct 25, 2023

@reslear is attempting to deploy a commit to the MSW Team on Vercel.

A member of the Team first needs to authorize it.

}

// Skip non-server API requests
if (url.origin !== process.env.API_URL) {
Copy link
Member

Choose a reason for hiding this comment

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

I would remove this from the example, it's too specific. It relies on the user having the API_URL env variable and even being familiar with the concept of env variables. Let's keep the example to the necessary minimum 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just saw your example with env variable

if (process.env.NODE_ENV !== 'development') {
and thought it was appropriate

I have other requests running on the server that don't need to be mocked, i believe that if this example had been and indexed by search, I wouldn't have spent 15 minutes looking for how to do it in issue :)

what if we moved it to faq with our h2 title like - "How to control or manage requests to different domains" ?

Copy link
Member

@kettanaito kettanaito left a comment

Choose a reason for hiding this comment

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

A great improvement! Just one comment about keeping the example to the minimum.

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

2 participants