-
Notifications
You must be signed in to change notification settings - Fork 563
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: add option ignoreTrailingSlash
to MockAgent and .intercept()
#3655
Conversation
Should we wait for a second opinion/approval? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a good idea.
@KhafraDev can you elaborate on that? |
ignoreTrailingSlashes
for MockAgent
I chattet with @KhafraDev and he sent me following tweet of @mcollina https://x.com/matteocollina/status/1828802494832705896 Seems like to every issue there is a tweet by matteo :D. Anyhow: |
ignoreTrailingSlashes
for MockAgentignoreTrailingSlashes
to MockAgent
ignoreTrailingSlashes
to MockAgentignoreTrailingSlash
to MockAgent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have it as an option on the client rather than passed in the .intercept options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, here we can update the docs: https://github.com/nodejs/undici/blob/main/docs/docs/api/MockPool.md#mockpoolinterceptoptions
ignoreTrailingSlash
to MockAgentignoreTrailingSlash
to MockAgent and .intercept()
Now you can set it globally on agent level and on intercept level. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Shall we backport it? |
…nodejs#3655) * fix: mock interceptor should ignore trailing slashes * only normalize path if it is a string * put tests into mock-interceptors.js * make ignoreTrailingSlashes an option of MockAgent * rename to ignoreTrailingSlash * make ignoreTrailingSlashes an option of .intercept * Apply suggestions from code review * add documentation
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-v6.x v6.x
# Navigate to the new working tree
cd .worktrees/backport-v6.x
# Create a new branch
git switch --create backport-3655-to-v6.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 c0be359aa5b3f2b8076fbad3413a43e8406f6741
# Push it to GitHub
git push --set-upstream origin backport-3655-to-v6.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-v6.x Then, create a pull request where the |
fixes #3649
Normalize the path in the mock interceptor