http: don't throw on `Uint8Array`s for `http.ServerResponse#write` · nodejs/node@ca83634 · GitHub
Skip to content

Commit ca83634

Browse files
rexagodBethGriggs
authored andcommitted
http: don't throw on Uint8Arrays for http.ServerResponse#write
Don't throw errors on Uint8Arrays and added test for all valid types. Backport-PR-URL: #33488 PR-URL: #33155 Fixes: #33379 Refs: #29829 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 2e77a10 commit ca83634

3 files changed

Lines changed: 31 additions & 5 deletions

File tree

lib/_http_outgoing.js

Lines changed: 5 additions & 3 deletions

test/parallel/test-http-outgoing-proto.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ assert.throws(() => {
8080
code: 'ERR_INVALID_ARG_TYPE',
8181
name: 'TypeError',
8282
message: 'The first argument must be of type string or an instance of ' +
83-
'Buffer. Received undefined'
83+
'Buffer or Uint8Array. Received undefined'
8484
});
8585

8686
assert.throws(() => {
@@ -90,7 +90,7 @@ assert.throws(() => {
9090
code: 'ERR_INVALID_ARG_TYPE',
9191
name: 'TypeError',
9292
message: 'The first argument must be of type string or an instance of ' +
93-
'Buffer. Received type number (1)'
93+
'Buffer or Uint8Array. Received type number (1)'
9494
});
9595

9696
// addTrailers()
Lines changed: 24 additions & 0 deletions

0 commit comments

Comments
 (0)