(read: () => Promise<string>)
| 517 | * not expect. The read is passed as a thunk so that `.clone()` throwing on an |
| 518 | * already-consumed body is caught here too, rather than escaping as a defect. */ |
| 519 | const safeBodyText = async (read: () => Promise<string>): Promise<string | null> => |
| 520 | Promise.resolve() |
| 521 | .then(read) |
| 522 | .then( |
| 523 | (value) => value, |
| 524 | () => null, |
| 525 | ); |
| 526 | |
| 527 | /** Structurally probe an untrusted upstream body. Returns `undefined` rather |
| 528 | * than a fabricated value when it is not JSON; the caller's schema decode |
no test coverage detected