()
| 160 | }; |
| 161 | |
| 162 | const onEnd = () => { |
| 163 | this.onData(chunks); |
| 164 | |
| 165 | const headers = { |
| 166 | // text/html is required instead of text/plain to avoid an |
| 167 | // unwanted download dialog on certain user-agents (GH-43) |
| 168 | "Content-Type": "text/html", |
| 169 | "Content-Length": "2", |
| 170 | }; |
| 171 | |
| 172 | res.writeHead(200, this.headers(req, headers)); |
| 173 | res.end("ok"); |
| 174 | cleanup(); |
| 175 | }; |
| 176 | |
| 177 | req.on("close", onClose); |
| 178 | if (!isBinary) req.setEncoding("utf8"); |