diff options
Diffstat (limited to 'ext/node/polyfills/_http_outgoing.ts')
-rw-r--r-- | ext/node/polyfills/_http_outgoing.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/node/polyfills/_http_outgoing.ts b/ext/node/polyfills/_http_outgoing.ts index b859d99ca..c4b88ae2f 100644 --- a/ext/node/polyfills/_http_outgoing.ts +++ b/ext/node/polyfills/_http_outgoing.ts @@ -251,7 +251,8 @@ export class OutgoingMessage extends Stream { this[kOutHeaders] = headers = Object.create(null); } - headers[name.toLowerCase()] = [name, value]; + name = name.toString(); + headers[name.toLowerCase()] = [name, value.toString()]; return this; } @@ -262,6 +263,8 @@ export class OutgoingMessage extends Stream { validateHeaderName(name); validateHeaderValue(name, value); + name = name.toString(); + const field = name.toLowerCase(); const headers = this[kOutHeaders]; if (headers === null || !headers[field]) { @@ -276,10 +279,10 @@ export class OutgoingMessage extends Stream { const existingValues = headers[field][1]; if (Array.isArray(value)) { for (let i = 0, length = value.length; i < length; i++) { - existingValues.push(value[i]); + existingValues.push(value[i].toString()); } } else { - existingValues.push(value); + existingValues.push(value.toString()); } return this; |