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

cleanAll method won't clean matchHeaders in the scope. #2253

Open
1 of 2 tasks
eethan1 opened this issue Nov 17, 2021 · 2 comments
Open
1 of 2 tasks

cleanAll method won't clean matchHeaders in the scope. #2253

eethan1 opened this issue Nov 17, 2021 · 2 comments
Labels

Comments

@eethan1
Copy link

eethan1 commented Nov 17, 2021

Please avoid duplicates

Reproducible test case

https://runkit.com/eethan1/nock-nock-issue-2253

Nock Version

13.1.3

Node Version

16.1.0

TypeScript Version

No response

What happened?

In intercept.js line 129

function removeAll() {
  Object.keys(allInterceptors).forEach(function (key) {
    allInterceptors[key].interceptors.forEach(function (interceptor) {
      interceptor.scope.keyedInterceptors = {}
    })
  })
  allInterceptors = {}
}

I think cleanAll should also clean matchheaders of the scope, or we should modify document related to the usage of matchHeader method like

scope
  .get('/repos/atom/atom/license') // create interceptor
  .matchHeader('authorization','foo') // then add `matchheaders` on it
  .reply(200, 'ok')

Would you be interested in contributing a fix?

  • yes
@eethan1 eethan1 added the bug label Nov 17, 2021
@gr2m
Copy link
Member

gr2m commented Nov 17, 2021

Could you share a minimal working code snippet such as this Runkit notebook that reproduces the actual problem? That will help us to derive a test case and get a pull request started

@eethan1
Copy link
Author

eethan1 commented Nov 17, 2021

Ok, I use runkit notebook and replace Reproducible test case with new link.

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

No branches or pull requests

3 participants