| 10397 | getResolveErrorBodyCallback, |
| 10398 | null, |
| 10399 | { callback, body: res, contentType, statusCode, statusMessage, headers } |
| 10400 | ); |
| 10401 | } else { |
| 10402 | if (factory === null) { |
| 10403 | return; |
| 10404 | } |
| 10405 | res = this.runInAsyncScope(factory, null, { |
| 10406 | statusCode, |
| 10407 | headers, |
| 10408 | opaque, |
| 10409 | context |
| 10410 | }); |
| 10411 | if (!res || typeof res.write !== "function" || typeof res.end !== "function" || typeof res.on !== "function") { |
| 10412 | throw new InvalidReturnValueError("expected Writable"); |
| 10413 | } |
| 10414 | finished(res, { readable: false }, (err) => { |
| 10415 | const { callback: callback2, res: res2, opaque: opaque2, trailers, abort } = this; |
| 10416 | this.res = null; |
| 10417 | if (err || !res2.readable) { |
| 10418 | util.destroy(res2, err); |
| 10419 | } |