(read: () => Promise<string>)
| 550 | * not expect. The read is passed as a thunk so that `.clone()` throwing on an |
| 551 | * already-consumed body is caught here too, rather than escaping as a defect. */ |
| 552 | const safeBodyText = async (read: () => Promise<string>): Promise<string | null> => |
| 553 | Promise.resolve() |
| 554 | .then(read) |
| 555 | .then( |
| 556 | (value) => value, |
| 557 | () => null, |
| 558 | ); |
| 559 | |
| 560 | /** Structurally probe an untrusted upstream body. Returns `undefined` rather |
| 561 | * than a fabricated value when it is not JSON; the caller's schema decode |
no test coverage detected