(raw: EncodedMessage)
| 294 | } |
| 295 | |
| 296 | export async function decodeResponseMessage(raw: EncodedMessage): Promise<DecodedResponseMessage> { |
| 297 | const { json: message, buffer } = await decodeRawMessage(raw) |
| 298 | |
| 299 | const [id, type, payload] = deserializeResponseMessage(message) |
| 300 | |
| 301 | if (type === MessageType.EVENT_ITERATOR || type === MessageType.ABORT_SIGNAL) { |
| 302 | return [id, type, payload as any] |
| 303 | } |
| 304 | |
| 305 | const response = payload as StandardResponse |
| 306 | const body = await deserializeBody(response.headers, response.body, buffer) |
| 307 | |
| 308 | return [id, type, { ...response, body }] |
| 309 | } |
| 310 | |
| 311 | /** |
| 312 | * Helper to deal with body and headers |
no test coverage detected