File tree 1 file changed +31
-0
lines changed 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Flags: --expose-http2
2
+ 'use strict' ;
3
+
4
+ const common = require ( '../common' ) ;
5
+ if ( ! common . hasCrypto )
6
+ common . skip ( 'missing crypto' ) ;
7
+ const http2 = require ( 'http2' ) ;
8
+
9
+ const server = http2 . createServer ( ) ;
10
+
11
+ // Test that ERR_HTTP2_INVALID_SESSION is thrown when a stream is destroyed
12
+ // before calling stream.session.shutdown
13
+ server . on ( 'stream' , common . mustCall ( ( stream ) => {
14
+ stream . session . destroy ( ) ;
15
+ common . expectsError (
16
+ ( ) => stream . session . shutdown ( ) ,
17
+ {
18
+ type : Error ,
19
+ code : 'ERR_HTTP2_INVALID_SESSION' ,
20
+ message : 'The session has been destroyed'
21
+ }
22
+ ) ;
23
+ } ) ) ;
24
+
25
+ server . listen ( 0 , common . mustCall ( ( ) => {
26
+ const client = http2 . connect ( `http://localhost:${ server . address ( ) . port } ` ) ;
27
+
28
+ const req = client . request ( ) ;
29
+ req . resume ( ) ;
30
+ req . on ( 'end' , common . mustCall ( ( ) => server . close ( ) ) ) ;
31
+ } ) ) ;
You can’t perform that action at this time.
0 commit comments