it('should send and receive streams', async () => { const {response, result} = await new Promise((resolve, reject) => { let response const output = new BufferList() const input = new BufferList() input.pipe( req.post(`${server.info.uri}/api/sample/streamHandling`) .on('response', r => { response = r }) .on('end', () => { resolve({response, result: output.toString()}) }) ) .pipe(output) .on('error', reject) input.append('here is the message body', 'utf8') }) assert(result === 'here is a prefix -- here is the message body') assert(response.headers['x-service-crc'] === checksum) assert(response.headers['transfer-encoding'] === 'chunked') assert(!response.headers['content-type']) })