Skip to content

Commit d76b3cb

Browse files
fix(response.write): call underlying implementation properly
1 parent 03361ec commit d76b3cb

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
@@ -85,8 +85,8 @@ function compression (options) {
8585
}
8686

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

9292
res.end = function end (chunk, encoding, cb) {
@@ -104,15 +104,15 @@ function compression (options) {
104104
}
105105

106106
if (!stream) {
107-
return _end.call(this, chunk, encoding)
107+
return _end.call(this, chunk, encoding, cb)
108108
}
109109

110110
// mark ended
111111
ended = true
112112

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

0 commit comments

Comments
 (0)