()
| 705 | let offset = 0 |
| 706 | |
| 707 | function writeChunk () { |
| 708 | while (offset < buffer.length) { |
| 709 | /* c8 ignore next 3 - defensive guard for aborted responses */ |
| 710 | if (res.destroyed || res.writableEnded) { |
| 711 | return |
| 712 | } |
| 713 | |
| 714 | const end = Math.min(offset + HTTP2_WRITE_CHUNK_SIZE, buffer.length) |
| 715 | const shouldContinue = res.write(buffer.subarray(offset, end)) |
| 716 | offset = end |
| 717 | |
| 718 | if (shouldContinue === false) { |
| 719 | res.once('drain', writeChunk) |
| 720 | return |
| 721 | } |
| 722 | } |
| 723 | |
| 724 | done() |
| 725 | } |
| 726 | |
| 727 | writeChunk() |
| 728 | } |
no test coverage detected