Skip to content

Commit 2991c82

Browse files
fix(response.write): handle end(cb)
1 parent 2440598 commit 2991c82

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,14 @@ function compression (options) {
9999
return false
100100
}
101101

102-
if (!cb && typeof encoding === 'function') {
103-
cb = encoding
104-
encoding = undefined
102+
if (!cb) {
103+
if (typeof chunk === 'function') {
104+
cb = chunk
105+
chunk = encoding = undefined
106+
} else if (typeof encoding === 'function') {
107+
cb = encoding
108+
encoding = undefined
109+
}
105110
}
106111

107112
if (!this._header) {

0 commit comments

Comments
 (0)