@@ -256,6 +256,38 @@ describe("Informational response steps", () => {
256256 } ) ;
257257 } ) ;
258258
259+ describe ( "with non-standard Expect headers" , ( ) => {
260+
261+ const server = getLocal ( ) ;
262+
263+ beforeEach ( ( ) => server . start ( ) ) ;
264+ afterEach ( ( ) => server . stop ( ) ) ;
265+
266+ it ( "routes a non-standard Expect through to the matching rule" , async ( ) => {
267+ const endpoint = await server . forGet ( '/x' ) . thenReply ( 200 , 'rule ran' ) ;
268+
269+ const sock = await openRawSocket ( server ) ;
270+ const raw = await new Promise < string > ( ( resolve , reject ) => {
271+ let buf = '' ;
272+ sock . on ( 'data' , d => { buf += d . toString ( 'utf8' ) ; } ) ;
273+ sock . on ( 'end' , ( ) => resolve ( buf ) ) ;
274+ sock . on ( 'error' , reject ) ;
275+ sock . write (
276+ `GET /x HTTP/1.1\r\nHost: localhost\r\n` +
277+ `Expect: x-weird-thing\r\nConnection: close\r\n\r\n`
278+ ) ;
279+ } ) ;
280+
281+ expect ( raw ) . to . contain ( 'HTTP/1.1 200' ) ;
282+ expect ( raw ) . to . contain ( 'rule ran' ) ;
283+ expect ( raw ) . not . to . contain ( '417' ) ;
284+
285+ const seen = await endpoint . getSeenRequests ( ) ;
286+ expect ( seen . length ) . to . equal ( 1 ) ;
287+ expect ( seen [ 0 ] . headers [ 'expect' ] ) . to . equal ( 'x-weird-thing' ) ;
288+ } ) ;
289+ } ) ;
290+
259291 describe ( "over HTTP/2" , ( ) => {
260292
261293 if ( nodeSatisfies ( BROKEN_H2_OVER_H2_TUNNELLING ) ) return ;
0 commit comments