Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup: dont modify HTTP2 code and remove unnecessary test
  • Loading branch information
rexagod committed May 23, 2020
commit 26efdc5a5073cfcb2ce831599a174f1c85dcb59f
18 changes: 2 additions & 16 deletions lib/internal/http2/compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const {
ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED,
ERR_HTTP2_STATUS_INVALID,
ERR_INVALID_ARG_VALUE,
ERR_INVALID_ARG_TYPE,
ERR_INVALID_CALLBACK,
ERR_INVALID_HTTP_TOKEN,
ERR_STREAM_WRITE_AFTER_END
Expand All @@ -48,7 +47,6 @@ const {
} = require('internal/errors');
const { validateString } = require('internal/validators');
const { kSocket, kRequest, kProxySocket } = require('internal/http2/util');
const { isUint8Array } = require('internal/util/types');

const kBeginSend = Symbol('begin-send');
const kState = Symbol('state');
Expand Down Expand Up @@ -700,20 +698,8 @@ class Http2ServerResponse extends Stream {
encoding = 'utf8';
}

if (chunk !== null && chunk !== undefined) {
if (typeof chunk === 'string' ||
(isUint8Array(chunk))) {
this.write(chunk, encoding);
} else {
// Will not be forwarded to Http2ServerResponse object
// since this behavior is not allowed in compat mode
const err = new ERR_INVALID_ARG_TYPE('chunk',
['string', 'Buffer', 'Uint8Array'],
chunk);
// Throws an ERR_HTTP2_STREAM_ERROR error
this.destroy(err);
}
}
if (chunk !== null && chunk !== undefined)
this.write(chunk, encoding);

state.headRequest = stream.headRequest;
state.ending = true;
Expand Down
20 changes: 0 additions & 20 deletions test/parallel/test-http2-res-end-types.js

This file was deleted.