-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
setHeader method may be set incorrectly #122
Comments
The issue is that if it is reversed it will break what the workaround is for. There are some frameworks with a broken / different res.set , so this uses the original instead when it is there. But they have a (broken in the same way) res.setHeader as well. |
This is the most recent comment that made the current implementation for reference: e3b1247 I will see if I can dig up the original issue / PR as well when I get back to a computer. |
PR: #19 |
My concern is that this is a workaround for a problem with a specific implementation of setHeader function but it is not targeted to that specific implementation. This would use the setHeader function of the passed in ServerResponse instance except in the specific case that it is express' |
I agree it is bad and I'm not sure i would have landed that pr if it were i, but it has been landed and is now part of the api. If you are ok with waiting a bit for me to get together a major release we can just remove it, otherwise just need a change that will not break folks . |
Sounds good. |
How goes the progress on this? I'm working on unit tests for a system we are upgrading from node 4.4.7 and have found that this is causing an exception when using node-mocks-http to create res. |
The method used to set the header won't work for mocked requests:
var setHeader = res.set ? http.OutgoingMessage.prototype.setHeader : res.setHeader
Should probably be something along the lines of:
var setHeader = res.setHeader ? res.setHeader : http.OutgoingMessage.prototype.setHeader
The text was updated successfully, but these errors were encountered: