parent
18e4fafb02
commit
6029064756
2 changed files with 12 additions and 1 deletions
|
@ -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;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -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', () => {
|
||||||
|
|
Loading…
Reference in a new issue