-
-
Notifications
You must be signed in to change notification settings - Fork 735
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
.reply is not returning the Interceptor #1822
Labels
support
General questions or support.
Comments
@idangozlan To perform what you're attempting to do, you need to save a reference of the interceptor. const scopeModel = nock('http://localhost');
const apiInterceptor = scopeModel.get('/api/...');
apiInterceptor.reply(200, response);
// ... do stuff
nock.removeInterceptor(apiInterceptor); |
got it. thanks :) |
Is this mentioned or even alluded to with an example in the Readme? I swear I spent a long time looking exactly for this and couldn't find anything? |
Not in any clear way. This should be included in #1606 |
Alexsey
added a commit
to Alexsey/nock
that referenced
this issue
Jul 1, 2020
The fact that `removeInterceptor` works on some chains and doesn't work on other chains is very confusing because it means that existing code may break while the behavior is getting only extended (opposit to modified). Also, because documentation is not giving a clear difference on what chain methods returns what type of values. There are a bunch of issues on it: nock#1822 nock#1117 nock#600
Alexsey
added a commit
to Alexsey/nock
that referenced
this issue
Jul 1, 2020
The fact that `removeInterceptor` works on some chains and doesn't work on other chains is very confusing because it means that existing code may break while the behavior is getting only extended (opposite to modified). Also, because documentation is not giving a clear difference on what chain methods returns what type of values. There are a bunch of issues on it: nock#1822 nock#1117 nock#600
Alexsey
added a commit
to Alexsey/nock
that referenced
this issue
Oct 3, 2020
The fact that `removeInterceptor` works on some chains and doesn't work on other chains is very confusing because it means that existing code may break while the behavior is getting only extended (opposite to modified). Also, because documentation is not giving a clear difference on what chain methods returns what type of values. There are a bunch of issues on it: nock#1822 nock#1117 nock#600
Alexsey
added a commit
to Alexsey/nock
that referenced
this issue
Oct 3, 2020
The fact that `removeInterceptor` works on some chains and doesn't work on other chains is very confusing because it means that existing code may break while the behavior is getting only extended (opposite to modified). Also, because documentation is not giving a clear difference on what chain methods returns what type of values. There are a bunch of issues on it: nock#1822 nock#1117 nock#600
Alexsey
added a commit
to Alexsey/nock
that referenced
this issue
Oct 3, 2020
The fact that `removeInterceptor` works on some chains and doesn't work on other chains is very confusing because it means that existing code may break while the behavior is getting only extended (opposite to modified). Also, because documentation is not giving a clear difference on what chain methods returns what type of values. There are a bunch of issues on it: nock#1822 nock#1117 nock#600
gr2m
pushed a commit
that referenced
this issue
Nov 7, 2021
The fact that `removeInterceptor` works on some chains and doesn't work on other chains is very confusing because it means that existing code may break while the behavior is getting only extended (opposite to modified). Also, because documentation is not giving a clear difference on what chain methods returns what type of values. There are a bunch of issues on it: #1822 #1117 #600
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the expected behavior?
scopeModel
to be the Interceptor, so we can runnock.removeInterceptor(scopeModel);
What is the actual behavior?
reply()
not returning the Interceptor, sonock.removeInterceptor(scopeModel);
will not workPossible solution
to return the Interceptor when using
reply()
, so we don't have to do it in 2 linesVersions
The text was updated successfully, but these errors were encountered: