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

master
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');
this._explicitStatus = true;
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;
},

View File

@ -44,6 +44,17 @@ describe('res.status=', () => {
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', () => {