| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - #Interface: DispatchInterceptor | ||
| 1 | + # Interface: DispatchInterceptor | ||
| 2 | 2 | ||
| 3 | 3 | Extends: `Function` | |
| 4 | 4 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -104,6 +104,10 @@ class StreamHandler extends AsyncResource { | |||
| 104 | 104 | { callback, body: res, contentType, statusCode, statusMessage, headers } | |
| 105 | 105 | ) | |
| 106 | 106 | } else { | |
| 107 | + if (factory === null) { | ||
| 108 | + return | ||
| 109 | + } | ||
| 110 | + | ||
| 107 | 111 | res = this.runInAsyncScope(factory, null, { | |
| 108 | 112 | statusCode, | |
| 109 | 113 | headers, | |
@@ -152,14 +156,18 @@ class StreamHandler extends AsyncResource { | |||
| 152 | 156 | onData (chunk) { | |
| 153 | 157 | const { res } = this | |
| 154 | 158 | ||
| 155 | - return res.write(chunk) | ||
| 159 | + return res ? res.write(chunk) : true | ||
| 156 | 160 | } | |
| 157 | 161 | ||
| 158 | 162 | onComplete (trailers) { | |
| 159 | 163 | const { res } = this | |
| 160 | 164 | ||
| 161 | 165 | removeSignal(this) | |
| 162 | 166 | ||
| 167 | + if (!res) { | ||
| 168 | + return | ||
| 169 | + } | ||
| 170 | + | ||
| 163 | 171 | this.trailers = util.parseHeaders(trailers) | |
| 164 | 172 | ||
| 165 | 173 | res.end() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -265,7 +265,7 @@ function consumeEnd (consume) { | |||
| 265 | 265 | pos += buf.byteLength | |
| 266 | 266 | } | |
| 267 | 267 | ||
| 268 | - resolve(dst) | ||
| 268 | + resolve(dst.buffer) | ||
| 269 | 269 | } else if (type === 'blob') { | |
| 270 | 270 | if (!Blob) { | |
| 271 | 271 | Blob = require('buffer').Blob | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1070,7 +1070,9 @@ function onParserTimeout (parser) { | |||
| 1070 | 1070 | ||
| 1071 | 1071 | function onSocketReadable () { | |
| 1072 | 1072 | const { [kParser]: parser } = this | |
| 1073 | - parser.readMore() | ||
| 1073 | + if (parser) { | ||
| 1074 | + parser.readMore() | ||
| 1075 | + } | ||
| 1074 | 1076 | } | |
| 1075 | 1077 | ||
| 1076 | 1078 | function onSocketError (err) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments