File tree 2 files changed +42
-0
lines changed
2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -519,6 +519,18 @@ class Http2ServerResponse extends Stream {
519
519
return this [ kStream ] . writableCorked ;
520
520
}
521
521
522
+ get writableHighWaterMark ( ) {
523
+ return this [ kStream ] . writableHighWaterMark ;
524
+ }
525
+
526
+ get writableFinished ( ) {
527
+ return this [ kStream ] . writableFinished ;
528
+ }
529
+
530
+ get writableLength ( ) {
531
+ return this [ kStream ] . writableLength ;
532
+ }
533
+
522
534
set statusCode ( code ) {
523
535
code |= 0 ;
524
536
if ( code >= 100 && code < 200 )
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ const common = require ( '../common' ) ;
3
+ if ( ! common . hasCrypto ) { common . skip ( 'missing crypto' ) ; }
4
+ const assert = require ( 'assert' ) ;
5
+ const http2 = require ( 'http2' ) ;
6
+
7
+ const server = http2 . createServer ( common . mustCall ( ( req , res ) => {
8
+ const hwm = req . socket . writableHighWaterMark ;
9
+ assert . strictEqual ( res . writableHighWaterMark , hwm ) ;
10
+ assert . strictEqual ( res . writableLength , 0 ) ;
11
+ res . write ( '' ) ;
12
+ const len = res . writableLength ;
13
+ res . write ( 'asd' ) ;
14
+ assert . strictEqual ( res . writableLength , len + 3 ) ;
15
+ res . end ( ) ;
16
+ res . on ( 'finish' , common . mustCall ( ( ) => {
17
+ assert . strictEqual ( res . writableLength , 0 ) ;
18
+ assert . ok ( res . writableFinished , 'writableFinished is not truthy' ) ;
19
+ server . close ( ) ;
20
+ } ) ) ;
21
+ } ) ) ;
22
+
23
+ server . listen ( 0 , common . mustCall ( ( ) => {
24
+ const client = http2 . connect ( `http://localhost:${ server . address ( ) . port } ` ) ;
25
+ const request = client . request ( ) ;
26
+ request . on ( 'data' , common . mustCall ( ) ) ;
27
+ request . on ( 'end' , common . mustCall ( ( ) => {
28
+ client . close ( ) ;
29
+ } ) ) ;
30
+ } ) ) ;
You can’t perform that action at this time.
0 commit comments