mirror of
https://github.com/grpc/grpc-node.git
synced 2025-12-08 18:23:54 +00:00
Merge pull request #534 from cjihrig/from-h2-headers
grpc-js-core: ignore reserved headers in fromHttp2Headers()
This commit is contained in:
commit
8664fd90b0
@ -233,8 +233,7 @@ export class Http2CallStream extends Duplex implements Call {
|
||||
default:
|
||||
this.mappedStatusCode = Status.UNKNOWN;
|
||||
}
|
||||
delete headers[HTTP2_HEADER_STATUS];
|
||||
delete headers[HTTP2_HEADER_CONTENT_TYPE];
|
||||
|
||||
if (flags & http2.constants.NGHTTP2_FLAG_END_STREAM) {
|
||||
this.handleTrailers(headers);
|
||||
} else {
|
||||
|
||||
@ -195,6 +195,11 @@ export class Metadata {
|
||||
static fromHttp2Headers(headers: http2.IncomingHttpHeaders): Metadata {
|
||||
const result = new Metadata();
|
||||
forOwn(headers, (values, key) => {
|
||||
// Reserved headers (beginning with `:`) are not valid keys.
|
||||
if (key.charAt(0) === ':') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isBinaryKey(key)) {
|
||||
if (Array.isArray(values)) {
|
||||
values.forEach((value) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user