Node.js: response body chunk can now be a Uint8Array.
Starting from Node.js 15.0.0 the chunk parameter of the response.write() can be a Uint8Array. This closes #870 issue on GitHub.
This commit is contained in:
@@ -243,8 +243,11 @@ ServerResponse.prototype._writeBody = function(chunk, encoding, callback) {
|
||||
}
|
||||
|
||||
if (chunk) {
|
||||
if (typeof chunk !== 'string' && !(chunk instanceof Buffer)) {
|
||||
throw new TypeError('First argument must be a string or Buffer');
|
||||
if (typeof chunk !== 'string' && !(chunk instanceof Buffer ||
|
||||
chunk instanceof Uint8Array)) {
|
||||
throw new TypeError(
|
||||
'First argument must be a string, Buffer, ' +
|
||||
'or Uint8Array');
|
||||
}
|
||||
|
||||
if (typeof chunk === 'string') {
|
||||
|
||||
Reference in New Issue
Block a user