@@ -21,80 +21,80 @@ assert.strictEqual(
2121 typeof ServerResponse . prototype . _implicitHeader , 'function' ) ;
2222
2323// validateHeader
24- assert . throws ( ( ) => {
24+ common . expectsError ( ( ) => {
2525 const outgoingMessage = new OutgoingMessage ( ) ;
2626 outgoingMessage . setHeader ( ) ;
27- } , common . expectsError ( {
27+ } , {
2828 code : 'ERR_INVALID_HTTP_TOKEN' ,
2929 type : TypeError ,
3030 message : 'Header name must be a valid HTTP token ["undefined"]'
31- } ) ) ;
31+ } ) ;
3232
33- assert . throws ( ( ) => {
33+ common . expectsError ( ( ) => {
3434 const outgoingMessage = new OutgoingMessage ( ) ;
3535 outgoingMessage . setHeader ( 'test' ) ;
36- } , common . expectsError ( {
36+ } , {
3737 code : 'ERR_HTTP_INVALID_HEADER_VALUE' ,
3838 type : TypeError ,
3939 message : 'Invalid value "undefined" for header "test"'
40- } ) ) ;
40+ } ) ;
4141
42- assert . throws ( ( ) => {
42+ common . expectsError ( ( ) => {
4343 const outgoingMessage = new OutgoingMessage ( ) ;
4444 outgoingMessage . setHeader ( 404 ) ;
45- } , common . expectsError ( {
45+ } , {
4646 code : 'ERR_INVALID_HTTP_TOKEN' ,
4747 type : TypeError ,
4848 message : 'Header name must be a valid HTTP token ["404"]'
49- } ) ) ;
49+ } ) ;
5050
51- assert . throws ( ( ) => {
51+ common . expectsError ( ( ) => {
5252 const outgoingMessage = new OutgoingMessage ( ) ;
5353 outgoingMessage . setHeader . call ( { _header : 'test' } , 'test' , 'value' ) ;
54- } , common . expectsError ( {
54+ } , {
5555 code : 'ERR_HTTP_HEADERS_SENT' ,
5656 type : Error ,
5757 message : 'Cannot set headers after they are sent to the client'
58- } ) ) ;
58+ } ) ;
5959
60- assert . throws ( ( ) => {
60+ common . expectsError ( ( ) => {
6161 const outgoingMessage = new OutgoingMessage ( ) ;
6262 outgoingMessage . setHeader ( '200' , 'あ' ) ;
63- } , common . expectsError ( {
63+ } , {
6464 code : 'ERR_INVALID_CHAR' ,
6565 type : TypeError ,
6666 message : 'Invalid character in header content ["200"]'
67- } ) ) ;
67+ } ) ;
6868
6969// write
70- assert . throws ( ( ) => {
70+ common . expectsError ( ( ) => {
7171 const outgoingMessage = new OutgoingMessage ( ) ;
7272 outgoingMessage . write ( ) ;
73- } , common . expectsError ( {
73+ } , {
7474 code : 'ERR_METHOD_NOT_IMPLEMENTED' ,
7575 type : Error ,
7676 message : 'The _implicitHeader() method is not implemented'
77- } ) ) ;
77+ } ) ;
7878
7979assert ( OutgoingMessage . prototype . write . call ( { _header : 'test' } ) ) ;
8080
81- assert . throws ( ( ) => {
81+ common . expectsError ( ( ) => {
8282 const outgoingMessage = new OutgoingMessage ( ) ;
8383 outgoingMessage . write . call ( { _header : 'test' , _hasBody : 'test' } ) ;
84- } , common . expectsError ( {
84+ } , {
8585 code : 'ERR_INVALID_ARG_TYPE' ,
8686 type : TypeError ,
8787 message : 'The first argument must be one of type string or Buffer'
88- } ) ) ;
88+ } ) ;
8989
90- assert . throws ( ( ) => {
90+ common . expectsError ( ( ) => {
9191 const outgoingMessage = new OutgoingMessage ( ) ;
9292 outgoingMessage . write . call ( { _header : 'test' , _hasBody : 'test' } , 1 ) ;
93- } , common . expectsError ( {
93+ } , {
9494 code : 'ERR_INVALID_ARG_TYPE' ,
9595 type : TypeError ,
9696 message : 'The first argument must be one of type string or Buffer'
97- } ) ) ;
97+ } ) ;
9898
9999// addTrailers()
100100// The `Error` comes from the JavaScript engine so confirm that it is a
@@ -105,20 +105,20 @@ assert.throws(() => {
105105 outgoingMessage . addTrailers ( ) ;
106106} , TypeError ) ;
107107
108- assert . throws ( ( ) => {
108+ common . expectsError ( ( ) => {
109109 const outgoingMessage = new OutgoingMessage ( ) ;
110110 outgoingMessage . addTrailers ( { 'あ' : 'value' } ) ;
111- } , common . expectsError ( {
111+ } , {
112112 code : 'ERR_INVALID_HTTP_TOKEN' ,
113113 type : TypeError ,
114114 message : 'Trailer name must be a valid HTTP token ["あ"]'
115- } ) ) ;
115+ } ) ;
116116
117- assert . throws ( ( ) => {
117+ common . expectsError ( ( ) => {
118118 const outgoingMessage = new OutgoingMessage ( ) ;
119119 outgoingMessage . addTrailers ( { 404 : 'あ' } ) ;
120- } , common . expectsError ( {
120+ } , {
121121 code : 'ERR_INVALID_CHAR' ,
122122 type : TypeError ,
123123 message : 'Invalid character in trailer content ["404"]'
124- } ) ) ;
124+ } ) ;
0 commit comments