(read: () => Promise<string>)
| 570 | * not expect. The read is passed as a thunk so that `.clone()` throwing on an |
| 571 | * already-consumed body is caught here too, rather than escaping as a defect. */ |
| 572 | const safeBodyText = async (read: () => Promise<string>): Promise<string | null> => |
| 573 | Promise.resolve() |
| 574 | .then(read) |
| 575 | .then( |
| 576 | (value) => value, |
| 577 | () => null, |
| 578 | ); |
| 579 | |
| 580 | /** Structurally probe an untrusted upstream body. Returns `undefined` rather |
| 581 | * than a fabricated value when it is not JSON; the caller's schema decode |
no test coverage detected