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

Trailing slash is required for request URI match #57

Closed
kettanaito opened this issue Mar 7, 2020 · 3 comments · Fixed by #62
Closed

Trailing slash is required for request URI match #57

kettanaito opened this issue Mar 7, 2020 · 3 comments · Fixed by #62
Assignees

Comments

@kettanaito
Copy link
Member

Current behavior

The following request handler:

rest.get('https://test.msw.io', ...)

Will not match https://test.msw.io/. The trailing slash if often appended automatically. For example, when performing:

fetch('https://test.msw.io')

The request URI would be resolved to https://test.msw.io/ (containing the trailing slash).

Expected behavior

  • Trailing slash is disregarded during request URI matching:
    • https://test.io === https://test.io/
  • Trailing slash is also disregarded when matching nested paths:
    • https://test.io/foo === https://test.io/foo/
@kettanaito
Copy link
Member Author

Request URI matching is performed by node-match-path library. The handling of a trailing slash looks like that library's responsibility and I think it should be implemented in that library.

@kettanaito
Copy link
Member Author

kettanaito commented Mar 10, 2020

Raised mswjs/node-match-path#4.

@hehehai, please, what is your opinion on this? Shall we ignore the trailing shash when matching request URLs?

@kettanaito
Copy link
Member Author

Published in msw@0.8.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant