@@ -78,17 +78,18 @@ const decoder = new TextDecoder();
7878 } ) ;
7979 await clientSession . opened ;
8080
81+ const requestHeaders = {
82+ // Mixed-case names — should be lowercased by buildNgHeaderString.
83+ ':method' : 'GET' ,
84+ ':path' : '/test' ,
85+ ':scheme' : 'https' ,
86+ ':authority' : 'localhost' ,
87+ 'X-Custom-Header' : 'Value1' ,
88+ 'Content-Type' : 'text/plain' ,
89+ 'X-Mixed-Case' : 'MixedValue' ,
90+ } ;
91+
8192 const stream = await clientSession . createBidirectionalStream ( {
82- headers : {
83- // Mixed-case names — should be lowercased by buildNgHeaderString.
84- ':method' : 'GET' ,
85- ':path' : '/test' ,
86- ':scheme' : 'https' ,
87- ':authority' : 'localhost' ,
88- 'X-Custom-Header' : 'Value1' ,
89- 'Content-Type' : 'text/plain' ,
90- 'X-Mixed-Case' : 'MixedValue' ,
91- } ,
9293 onheaders : mustCall ( function ( headers ) {
9394 // Client should also receive lowercased response header names.
9495 assert . strictEqual ( headers [ ':status' ] , '200' ) ;
@@ -103,6 +104,13 @@ const decoder = new TextDecoder();
103104 } ) ,
104105 } ) ;
105106
107+ assert . throws ( ( ) => stream . sendHeaders ( {
108+ ...requestHeaders ,
109+ ':path' : 'testwtpath' ,
110+ } ) , { code : 'ERR_INVALID_ARG_VALUE' } ) ;
111+ assert . strictEqual (
112+ stream . sendHeaders ( requestHeaders , { terminal : true } ) , true ) ;
113+
106114 const body = await bytes ( stream ) ;
107115 assert . strictEqual ( decoder . decode ( body ) , 'ok' ) ;
108116 await Promise . all ( [ stream . closed , serverDone . promise ] ) ;
0 commit comments