Skip to content

Throw error when leading slash is not present in path#1391

Merged
gr2m merged 3 commits intonock:betafrom
kevinnio:fix-no-leading-slash
Jan 25, 2019
Merged

Throw error when leading slash is not present in path#1391
gr2m merged 3 commits intonock:betafrom
kevinnio:fix-no-leading-slash

Conversation

@kevinnio
Copy link
Copy Markdown
Contributor

@kevinnio kevinnio commented Jan 22, 2019

Previously, whenever you intercept a path with no leading slash nock will not resolve the URL correctly. This fixes the issue by adding a leading slash if required while creating an Interceptor.

Given #1391 (comment), we decided to make nock raise an error whenever the user forgets to add a leading slash into the intercepted path, instead of adding it itself.

Fixes #1259.

@paulmelnikow
Copy link
Copy Markdown
Member

Hi! Thanks for this contribution :)

New work is being done in the beta branch. Could you rebase this?

@kevinnio kevinnio changed the base branch from master to beta January 23, 2019 19:01
@kevinnio
Copy link
Copy Markdown
Contributor Author

Rebased onto beta branch.

Previously, whenever you intercept a path with no leading slash nock will
not resolve the URL correctly. This fixes the issue by adding a leading
slash if required while creating an Interceptor.

Check #1259 to know more.
Copy link
Copy Markdown
Member

@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

This looks great now! Thanks for bearing with us Kevin 👍

Given #1391 (comment), we
decided to make nock raise an error whenever the user forgets to add a
leading slash into the intercepted path, instead of adding it itself.
@kevinnio kevinnio changed the title Add leading slash when is not present in path Throw error when leading slash is not present in path Jan 24, 2019
Copy link
Copy Markdown
Member

@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

🚢

@gr2m gr2m merged commit 28b2d43 into nock:beta Jan 25, 2019
@nockbot
Copy link
Copy Markdown
Collaborator

nockbot commented Jan 25, 2019

🎉 This PR is included in version 11.0.0-beta.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@paulmelnikow
Copy link
Copy Markdown
Member

@gr2m I noticed this is listed as a big fix but I think it might be better to call it out as a new feature when 11 is released.

@gr2m
Copy link
Copy Markdown
Member

gr2m commented Jan 25, 2019

works for me, we can edit the release notes

@nockbot
Copy link
Copy Markdown
Collaborator

nockbot commented Aug 13, 2019

🎉 This PR is included in version 11.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

gr2m pushed a commit that referenced this pull request Sep 4, 2019
Given #1391 (comment), we
decided to make nock raise an error whenever the user forgets to add a
leading slash into the intercepted path, instead of adding it itself.
gr2m pushed a commit that referenced this pull request Sep 4, 2019
Given #1391 (comment), we
decided to make nock raise an error whenever the user forgets to add a
leading slash into the intercepted path, instead of adding it itself.
gr2m pushed a commit that referenced this pull request Sep 5, 2019
Given #1391 (comment), we
decided to make nock raise an error whenever the user forgets to add a
leading slash into the intercepted path, instead of adding it itself.
@uxmaster
Copy link
Copy Markdown

Nock should not throw when the path equals '', to enable testing paths without trailing slash, see #2042 (comment)

uxmaster added a commit to uxmaster/nock that referenced this pull request Jan 16, 2021
This artificial requirement was introduced by nock#1391.
uxmaster added a commit to uxmaster/nock that referenced this pull request Jan 16, 2021
juninmd pushed a commit to juninmd/nock that referenced this pull request Mar 21, 2026
Given nock#1391 (comment), we
decided to make nock raise an error whenever the user forgets to add a
leading slash into the intercepted path, instead of adding it itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants