(body, type)
| 188 | waitingWithBody(wrapWithAsyncIterable(createReadStream(__filename)), 'async-iterator') |
| 189 | |
| 190 | function writeHeadersStartedWithBody (body, type) { |
| 191 | test(`Abort ${controllerName} while waiting response (write headers started) (with body ${type})`, async (t) => { |
| 192 | const p = tspl(t, { plan: 1 }) |
| 193 | |
| 194 | const abortController = new AbortControllerImpl() |
| 195 | const server = createServer({ joinDuplicateHeaders: true }, (req, res) => { |
| 196 | res.writeHead(200, { 'content-type': 'text/plain' }) |
| 197 | res.flushHeaders() |
| 198 | abortController.abort() |
| 199 | res.end('hello world') |
| 200 | }) |
| 201 | t.after(closeServerAsPromise(server)) |
| 202 | |
| 203 | server.listen(0, () => { |
| 204 | const client = new Client(`http://localhost:${server.address().port}`) |
| 205 | t.after(client.destroy.bind(client)) |
| 206 | |
| 207 | client.request({ path: '/', method: 'POST', body, signal: abortController.signal }, (err, response) => { |
| 208 | p.ok(err instanceof errors.RequestAbortedError || err instanceof DOMException) |
| 209 | }) |
| 210 | }) |
| 211 | await p.completed |
| 212 | }) |
| 213 | } |
| 214 | |
| 215 | writeHeadersStartedWithBody('hello', 'string') |
| 216 | writeHeadersStartedWithBody(createReadStream(__filename), 'stream') |
no test coverage detected
searching dependent graphs…