question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`removeInterceptor` with scope as an argument.

See original GitHub issue

It’s very easy to mistakenly pass a scope to removeInterceptor and not be aware it’s wrong.

First the difference between interceptor and scope is not explained at all in the README, as far as I can tell.

Second, after passing scope to removeInterceptor it actually returns true, even though it does not remove a single item. true is returned unconditionally here: https://github.com/node-nock/nock/blob/11f1a25ee88b0328c92070e4749793902907a60d/lib/intercept.js#L219 no matter if there was a single match in the inner loop just above it, or not.

It seems to me that passing a scope should just work, and be handled correctly (by removing all interceptor from the scope).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
gr2mcommented, May 3, 2018

Thanks Adara for letting us know. We plan to invest some time to improve the documentation soon, so this is timely and valuable input 😃

0reactions
lock[bot]commented, Jan 10, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue and add a reference to this one if it’s related. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

nock/nock: HTTP server mocking and expectations ... - GitHub
method returns Scope, not Interceptor, and so it is not a valid argument for nock.removeInterceptor . So if your method chain ends with...
Read more >
Uses of Interface de.hybris.platform.servicelayer.interceptor ...
Methods in de.hybris.platform.servicelayer.internal.model.impl.wrapper that return types with arguments of type RemoveInterceptor ...
Read more >
HTTP Server mocking for Node.js
removeInterceptor (options); function nock.scope.restore (); object nock.scope.emitter ... if( arguments.length === 2 ) { nockedFn = options; ...
Read more >
Unable to remove interceptors using nock - Stack Overflow
I am using nock and I'm trying to remove interceptors for certain hostname. I have tried using: nock.removeInterceptor({ hostname: 'somehostname ...
Read more >
nock - Devpost
You can specify the request body to be matched as the second argument to the get , post , put or delete specifications...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found