File tree 3 files changed +31
-3
lines changed
3 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -636,10 +636,11 @@ OutgoingMessage.prototype._flush = function() {
636
636
637
637
OutgoingMessage . prototype . flushHeaders = function ( ) {
638
638
if ( ! this . _header ) {
639
- // Force-flush the headers.
640
639
this . _implicitHeader ( ) ;
641
- this . _send ( '' ) ;
642
640
}
641
+
642
+ // Force-flush the headers.
643
+ this . _send ( '' ) ;
643
644
} ;
644
645
645
646
OutgoingMessage . prototype . flush = util . deprecate ( function ( ) {
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ const http = require('http');
5
5
6
6
const server = http . createServer ( ) ;
7
7
server . on ( 'request' , function ( req , res ) {
8
- assert ( req . headers [ 'foo' ] , 'bar' ) ;
8
+ assert . equal ( req . headers [ 'foo' ] , 'bar' ) ;
9
9
res . end ( 'ok' ) ;
10
10
server . close ( ) ;
11
11
} ) ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ const common = require ( '../common' ) ;
3
+ const assert = require ( 'assert' ) ;
4
+ const http = require ( 'http' ) ;
5
+
6
+ const server = http . createServer ( ) ;
7
+
8
+ server . on ( 'request' , function ( req , res ) {
9
+ res . writeHead ( 200 , { 'foo' : 'bar' } ) ;
10
+ res . flushHeaders ( ) ;
11
+ res . flushHeaders ( ) ; // Should be idempotent.
12
+ } ) ;
13
+ server . listen ( common . PORT , common . localhostIPv4 , function ( ) {
14
+ var req = http . request ( {
15
+ method : 'GET' ,
16
+ host : common . localhostIPv4 ,
17
+ port : common . PORT ,
18
+ } , onResponse ) ;
19
+
20
+ req . end ( ) ;
21
+
22
+ function onResponse ( res ) {
23
+ assert . equal ( res . headers [ 'foo' ] , 'bar' ) ;
24
+ res . destroy ( ) ;
25
+ server . close ( ) ;
26
+ }
27
+ } ) ;
You can’t perform that action at this time.
0 commit comments