| 279 | public _implicitHeader() {} |
| 280 | |
| 281 | public _write( |
| 282 | chunk: Buffer | string, |
| 283 | _encoding: string, |
| 284 | callback: (error?: Error | null) => void |
| 285 | ) { |
| 286 | this.write(chunk) |
| 287 | |
| 288 | // According to Node.js documentation, the callback MUST be invoked to |
| 289 | // signal that the write completed successfully. If this callback is not |
| 290 | // invoked, the 'finish' event will not be emitted. |
| 291 | // |
| 292 | // https://nodejs.org/docs/latest-v16.x/api/stream.html#writable_writechunk-encoding-callback |
| 293 | // |
| 294 | // If the stream was destroyed due to an error, we should propagate it |
| 295 | if (this.destroyed && this.errored) { |
| 296 | callback(this.errored) |
| 297 | } else { |
| 298 | callback() |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | public writeHead( |
| 303 | statusCode: number, |