Skip to content

Commit f4a997e

Browse files
fix: call underlying implementation properly
1 parent 3fea81d commit f4a997e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function compression (options) {
7575

7676
// proxy
7777

78-
res.write = function write (chunk, encoding) {
78+
res.write = function write (chunk, encoding, cb) {
7979
if (ended) {
8080
return false
8181
}
@@ -85,11 +85,11 @@ function compression (options) {
8585
}
8686

8787
return stream
88-
? stream.write(toBuffer(chunk, encoding))
88+
? stream.write(toBuffer(chunk, encoding), cb || encoding)
8989
: _write.call(this, chunk, encoding)
9090
}
9191

92-
res.end = function end (chunk, encoding) {
92+
res.end = function end (chunk, encoding, cb) {
9393
if (ended) {
9494
return false
9595
}
@@ -112,7 +112,7 @@ function compression (options) {
112112

113113
// write Buffer for Node.js 0.8
114114
return chunk
115-
? stream.end(toBuffer(chunk, encoding))
115+
? stream.end(toBuffer(chunk, encoding), cb || encoding)
116116
: stream.end()
117117
}
118118

0 commit comments

Comments
 (0)