-
Notifications
You must be signed in to change notification settings - Fork 30k
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
error http request at headers is array #8235
Comments
From docs:
You should use headersObj. |
@disharmonized this code work well var http = require("http");
var headersArray = [
['Host','echo.websocket.org'],
['Connection','Upgrade'],
// ['Upgrade','websocket'],
['Origin','http://www.websocket.org'],
];
var req = http.request({
method: "GET",
host: "echo.websocket.org" ,
path: "ws://echo.websocket.org/?encoding=text",
headers: headersArray
});
req.on('response',function(res){
console.log('response' , res.headers);
});
req.on('upgrade',function(res){
console.log('upgrade',res.headers);
});
req.end(); |
Hmm, interesting... |
You really should use the documented API for headers (objects, not arrays). Nonetheless, I have a fix for this in #8238. |
Array is only way to send duplicate headers. |
What server requires duplicate HTTP headers? |
For proxy server. |
This commit fixes connection upgrade checks, specifically when headers are passed as an array instead of a plain object to http.request() Fixes: nodejs#8235 PR-URL: nodejs#8238 Reviewed-By: James M Snell <[email protected]>
This commit fixes connection upgrade checks, specifically when headers are passed as an array instead of a plain object to http.request() Fixes: nodejs#8235 PR-URL: nodejs#8238 Reviewed-By: James M Snell <[email protected]>
This commit fixes connection upgrade checks, specifically when headers are passed as an array instead of a plain object to http.request() Fixes: #8235 PR-URL: #8238 Reviewed-By: James M Snell <[email protected]>
This commit fixes connection upgrade checks, specifically when headers are passed as an array instead of a plain object to http.request() Fixes: nodejs#8235 PR-URL: nodejs#8238 Reviewed-By: James M Snell <[email protected]>
This commit fixes connection upgrade checks, specifically when headers are passed as an array instead of a plain object to http.request() Fixes: #8235 PR-URL: #8238 Reviewed-By: James M Snell <[email protected]>
test case
error output
The text was updated successfully, but these errors were encountered: