File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -83,8 +83,8 @@ module.exports = {
83
83
set status ( code ) {
84
84
if ( this . headerSent ) return ;
85
85
86
- assert ( 'number' == typeof code , 'status code must be a number' ) ;
87
- assert ( statuses [ code ] , `invalid status code: ${ code } ` ) ;
86
+ assert ( Number . isInteger ( code ) , 'status code must be a number' ) ;
87
+ assert ( code >= 100 && code <= 999 , `invalid status code: ${ code } ` ) ;
88
88
this . _explicitStatus = true ;
89
89
this . res . statusCode = code ;
90
90
if ( this . req . httpVersionMajor < 2 ) this . res . statusMessage = statuses [ code ] ;
Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ describe('res.status=', () => {
24
24
describe ( 'and invalid' , ( ) => {
25
25
it ( 'should throw' , ( ) => {
26
26
assert . throws ( ( ) => {
27
- response ( ) . status = 999 ;
28
- } , / i n v a l i d s t a t u s c o d e : 9 9 9 / ) ;
27
+ response ( ) . status = 99 ;
28
+ } , / i n v a l i d s t a t u s c o d e : 9 9 / ) ;
29
29
} ) ;
30
30
} ) ;
31
31
You can’t perform that action at this time.
0 commit comments