-
-
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
Avoid failing on headers conflict #804
Comments
Hi, I vote for this issue to be fixed. It's annoying me too when I use const scope = nock(URL, {encodedQueryParams: true})
.defaultReplyHeaders({
'Content-Type': 'application/json;charset=UTF-8'
}) Then if I try to override the scope
.post('/login', `login=${USER}&password=${PASSWORD}`)
.reply(200, '<login>ok</login>', [
'Content-Type', 'application/xml',
'Set-Cookie', 'JSESSIONID=foobar;Path=/foobar;Secure;HttpOnly'
]) I get the following error:
The only solution is to convert all headers to lowercase. But nock should not require me to do this, it should be case insensitive. |
@felipead Your example makes clear that this example is a bug/undesired. If you or @nfroidure are able to open a PR fixing this please do so. Otherwise I will try to get to when I have free time. |
Thanks! |
@ianwsperber Hey there appears to be an open PR, can you get the resolved? |
@moaxaca Just left a comment on the PR! You can help get the PR merged faster if you could confirm whether it fixes the bug on your machine 😄 |
@ianwsperber PR seems to works on my machine. 👍 I will dig into the change later tonight. |
Thanks @moaxaca! Please comment on the PR when you have a chance. |
@ianwsperber @moaxaca The PR has been updated 👍 |
@dcstone09 Sounds good pulling it in 40m to see if everything passes. |
🎉 |
Any updates here? |
@CFreeAtEbsco I just updated the test, everything looks good to me. |
Why hasn't this been merged yet? It would appear to be a mostly harmless PR. Last given option should override earlier ones, like every other node library around. |
@tedeh snarky comments won't get you anywhere. I understand your frustration, but please refrain from doing it on any open source project, ever <3 |
You are right and I'm sorry. Is there anything in your opinion that prevents this from being merged as-is? Maybe I can help with the verification. |
Thanks Tedde, it's already merged :) But the build failed so it's not released yet, if you could have a look at it that would be much appreciated: https://travis-ci.org/node-nock/nock/builds/340676385 |
@gr2m is this released? |
@gkatsanos Should have been! v9.1.7 got it. https://github.com/nock/nock/releases/tag/v9.1.7 |
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! |
The folowing error happen when a header has been set by the client library twice (one time in uppercase and another time in lower case.
Failed to convert header keys to lower case due to field name conflict: {headerName}
.It is certainly a bad practice to do so but the fact is that nock is used mostly to mock external libraries calls so it would be useful to be able to disable error throwing for such cases with some options.
The text was updated successfully, but these errors were encountered: