Skip to content

Commit

Permalink
Fix receiving trailers
Browse files Browse the repository at this point in the history
  • Loading branch information
szmarczak committed Aug 13, 2018
1 parent 8d7febd commit e189406
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions source/HTTP2ClientRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ class HTTP2ClientRequest extends Writable {
});

this._request.on('trailers', (trailers, flags, rawTrailers) => {
self.res.trailers = trailers;
self.res.rawTrailers = rawTrailers;
Object.assign(self.res.trailers, trailers);
Object.assign(self.res.rawTrailers, rawTrailers);
});

if (!this[kCustomSession]) {
Expand Down
2 changes: 1 addition & 1 deletion source/HTTP2IncomingMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class HTTP2IncomingMessage extends Readable {
this.httpVersionMajor = 2;
this.httpVersionMinor = 0;
this.headers = response.headers;
this.trailers = [];
this.trailers = {};
this.req = req;

this.aborted = false;
Expand Down
1 change: 1 addition & 0 deletions test/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ test('can provide custom session', async t => {

const res = await pEvent(req, 'response');
res.resume();
session.close();
t.pass();
});

Expand Down

0 comments on commit e189406

Please sign in to comment.