HTTP/2 has no status message (#1048) (#1049)

This commit is contained in:
Bernie Stern 2017-11-06 07:17:43 -05:00 committed by jongleberry
parent 18e4fafb02
commit 6029064756
2 changed files with 12 additions and 1 deletions

View file

@ -85,7 +85,7 @@ module.exports = {
assert(!this.res.headersSent, 'headers have already been sent'); assert(!this.res.headersSent, 'headers have already been sent');
this._explicitStatus = true; this._explicitStatus = true;
this.res.statusCode = code; this.res.statusCode = code;
this.res.statusMessage = statuses[code]; if (this.req.httpVersionMajor < 2) this.res.statusMessage = statuses[code];
if (this.body && statuses.empty[code]) this.body = null; if (this.body && statuses.empty[code]) this.body = null;
}, },

View file

@ -44,6 +44,17 @@ describe('res.status=', () => {
assert.doesNotThrow(() => response().status = 700); assert.doesNotThrow(() => response().status = 700);
}); });
}); });
describe('and HTTP/2', () => {
it('should not set the status message', () => {
const res = response({
'httpVersionMajor': 2,
'httpVersion': '2.0'
});
res.status = 200;
assert(!res.res.statusMessage);
});
});
}); });
describe('when a status string', () => { describe('when a status string', () => {