-
-
Notifications
You must be signed in to change notification settings - Fork 736
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
reqheaders does not work when using an undefined requestBody #2545
Comments
thanks, fixed 👍 |
This is because we ignore the interceptor's headers: Lines 68 to 74 in f4d1b15
What's the expected behavior? Should we merge the headers? Do the interceptor's headers take precedence? vice-versa? P.S: @josephearl I think it worked on |
I don't know out of hand, I'd have to digg into it as well. I'd look at tests first to see if the behavior might be covered |
Please avoid duplicates
Reproducible test case
https://github.com/josephearl/nock-reqheaders-repro
Nock Version
13.3.7
Node Version
v18.17.1
TypeScript Version
N/A
What happened?
When creating a request matcher and using
reqheaders
, these do not work when setting an undefinedrequestBody
:Strangely if you use
null
for therequestBody
it does work - butnull
is not allowed by the TypeScript types which specificyrequestBody
must beundefined | RequestBody
and theRequestBody
type does not includenull
in its union.Expected is that when using
undefined
for arequestBody
thereqheaders
matching still works.See https://github.com/josephearl/nock-reqheaders-repro/tree/main for a reproducer.
NB: the
all open bugs
link (https://github.com/nock/nock.js/issues?q=is%3Aissue+is%3Aopen+label%3Abug) in your issue template leads to a 404 - because it is pointing to an old repo namenock.js
Would you be interested in contributing a fix?
The text was updated successfully, but these errors were encountered: