(stream, data)
| 18 | } |
| 19 | |
| 20 | function addData(stream, data) { |
| 21 | if (Buffer.isBuffer(data) || typeof data === 'string' || data instanceof Uint8Array) { |
| 22 | stream[BODY].push(Buffer.from(data)); |
| 23 | } else { |
| 24 | throw new Error(`response.write() of unexpected type: ${typeof data}`); |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | module.exports = class ServerlessResponse extends http.ServerResponse { |
| 29 |