(
status: number,
statusText: string,
body?: string | Blob,
headers?: Record<string, string>,
)
| 721 | }; |
| 722 | |
| 723 | mockFlush( |
| 724 | status: number, |
| 725 | statusText: string, |
| 726 | body?: string | Blob, |
| 727 | headers?: Record<string, string>, |
| 728 | ): void { |
| 729 | this.clearWarningTimeout?.(); |
| 730 | if (typeof body === 'string') { |
| 731 | this.response.setupBodyStream(body); |
| 732 | } else { |
| 733 | this.response.setBody(body); |
| 734 | } |
| 735 | const response = new Response(this.response.stream, { |
| 736 | statusText, |
| 737 | headers: {...this.response.headers, ...(headers ?? {})}, |
| 738 | }); |
| 739 | |
| 740 | // Have to be set outside the constructor because it might throw |
| 741 | // RangeError: init["status"] must be in the range of 200 to 599, inclusive |
| 742 | Object.defineProperty(response, 'status', {value: status}); |
| 743 | |
| 744 | if (this.response.url) { |
| 745 | // url is readonly |
| 746 | Object.defineProperty(response, 'url', {value: this.response.url}); |
| 747 | } |
| 748 | this.resolve(response); |
| 749 | } |
| 750 | |
| 751 | mockProgressEvent(loaded: number): void { |
| 752 | this.response.progress.push(loaded); |
no test coverage detected