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

removeInterceptor doesn't work if nock basePath contains port #2194

Closed
noamshan opened this issue May 8, 2021 · 2 comments
Closed

removeInterceptor doesn't work if nock basePath contains port #2194

noamshan opened this issue May 8, 2021 · 2 comments
Labels
support General questions or support.

Comments

@noamshan
Copy link

noamshan commented May 8, 2021

nock('http://example.test').get('/somepath').reply(200, 'hey') // taken from this repo test code
nock.removeInterceptor({hostname: 'example.test', path: '/somepath'})
true
n=nock('http://example.test:8043').get('/somepath').reply(200, 'hey') // added port
nock.removeInterceptor({hostname: 'example.test', path: '/somepath'})
false
nock.removeInterceptor({hostname: 'example.test:8043', path: '/somepath'})
false

Am I doing anything wrong? If not, can it be fixed?

@pillsilly
Copy link

options.hostname = options.host.split(':')[0]

I guess that's intended as a host name is something without port.

Meanwhile I proposed more flexible way for removing interceptors.
see #2141

@gr2m gr2m added the support General questions or support. label Nov 8, 2021
@gr2m
Copy link
Member

gr2m commented Nov 8, 2021

I'll close the issue as the original question has been answered. I'll get back to your PR @pillsilly

@gr2m gr2m closed this as completed Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support General questions or support.
Projects
None yet
Development

No branches or pull requests

3 participants