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(intercept): handle global flags during regexp matching #2135

Merged
merged 1 commit into from Jan 20, 2021

Conversation

mastermatt
Copy link
Member

When matching via a regexp instance, consistently test the entire target string.
Sets the lastIndex to zero for cases where the global flag is set and the regexp instance has been tested previously.

fixes: #2134

@mastermatt mastermatt requested a review from a team January 19, 2021 16:57
When matching via a regexp instance, consistently test the entire target
string.
Sets the `lastIndex` to zero for cases where the `global` flag is set
and the
regexp instance has been tested previously.

fixes: nock#2134
Comment on lines +420 to +421
// if the regexp happens to have a global flag, we want to ensure we test the entire target
pattern.lastIndex = 0
Copy link
Member

Choose a reason for hiding this comment

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

huh, today I learned 👍🏼

@mastermatt mastermatt merged commit dc04694 into nock:main Jan 20, 2021
@mastermatt mastermatt deleted the 2134-global-regexp branch January 20, 2021 20:04
@github-actions
Copy link

🎉 This PR is included in version 13.0.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

RegExp with global flag does not match the request path
2 participants