-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http: throw if 'host' agent header is not a string value
If the 'host' agent header is an array or other non-string value, throw. PR-URL: #29568 Fixes: #29408 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
|
||
const assert = require('assert'); | ||
const http = require('http'); | ||
|
||
{ | ||
|
||
const options = { | ||
port: '80', | ||
path: '/', | ||
headers: { | ||
host: [] | ||
} | ||
}; | ||
|
||
assert.throws(() => { | ||
http.request(options); | ||
}, { | ||
code: /ERR_INVALID_ARG_TYPE/ | ||
}, 'http request should throw when passing array as header host'); | ||
} |