File tree Expand file tree Collapse file tree 2 files changed +7
-14
lines changed Expand file tree Collapse file tree 2 files changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ unreleased
1818 - perf: hoist regex declaration
1919 - perf: use regex to extract mime
2020 * perf: enable strict mode
21+ * perf: remove flush reassignment
2122 * perf: simplify threshold detection
2223
23241.4.4 / 2015-05-11
Original file line number Diff line number Diff line change @@ -57,8 +57,12 @@ function compression(options) {
5757 var end = res . end
5858 var stream
5959
60- // flush is noop by default
61- res . flush = noop ;
60+ // flush
61+ res . flush = function flush ( ) {
62+ if ( stream ) {
63+ stream . flush ( )
64+ }
65+ }
6266
6367 // proxy
6468
@@ -178,11 +182,6 @@ function compression(options) {
178182 // add bufferred listeners to stream
179183 addListeners ( stream , stream . on , listeners )
180184
181- // overwrite the flush method
182- res . flush = function ( ) {
183- stream . flush ( ) ;
184- }
185-
186185 // header fields
187186 res . setHeader ( 'Content-Encoding' , method ) ;
188187 res . removeHeader ( 'Content-Length' ) ;
@@ -232,13 +231,6 @@ function chunkLength(chunk, encoding) {
232231 : chunk . length
233232}
234233
235- /**
236- * No-operation function
237- * @private
238- */
239-
240- function noop ( ) { }
241-
242234/**
243235 * Default filter function.
244236 * @private
You can’t perform that action at this time.
0 commit comments