(
url: string,
response: string | {text(): Promise<string>; status?: number},
)
| 155 | } |
| 156 | |
| 157 | async function unwrapResponse( |
| 158 | url: string, |
| 159 | response: string | {text(): Promise<string>; status?: number}, |
| 160 | ): Promise<string> { |
| 161 | if (typeof response === 'string') { |
| 162 | return response; |
| 163 | } |
| 164 | |
| 165 | if (response.status !== undefined && response.status !== 200) { |
| 166 | throw new RuntimeError( |
| 167 | RuntimeErrorCode.EXTERNAL_RESOURCE_LOADING_FAILED, |
| 168 | ngDevMode && `Could not load resource: ${url}. Response status: ${response.status}`, |
| 169 | ); |
| 170 | } |
| 171 | |
| 172 | return response.text(); |
| 173 | } |
no test coverage detected
searching dependent graphs…