(call: FetchCall | undefined)
| 596 | } |
| 597 | |
| 598 | function parseRecordedJsonBody(call: FetchCall | undefined): unknown { |
| 599 | const body = call?.init.body; |
| 600 | if (typeof body !== 'string') { |
| 601 | throw new TypeError('expected recorded fetch body to be a JSON string'); |
| 602 | } |
| 603 | return JSON.parse(body) as unknown; |
| 604 | } |
| 605 | |
| 606 | function okEnvelope<T>(data: T): { code: 0; msg: string; data: T; request_id: string } { |
| 607 | return { code: 0, msg: 'success', data, request_id: 'req_test' }; |