( response, responseType )
| 67 | } |
| 68 | |
| 69 | async function parseResponseBody ( response, responseType ) { |
| 70 | if ( responseType === 'none' ) { |
| 71 | return null |
| 72 | } |
| 73 | |
| 74 | if ( responseType === 'text' ) { |
| 75 | return await response.text() |
| 76 | } |
| 77 | |
| 78 | const text = await response.text() |
| 79 | |
| 80 | if ( text.length === 0 ) { |
| 81 | return null |
| 82 | } |
| 83 | |
| 84 | return JSON.parse( text ) |
| 85 | } |
| 86 | |
| 87 | function buildRequestInit ( { |
| 88 | body, |