MCPcopy
hub / github.com/angular/angular / unwrapResponse

Function unwrapResponse

packages/core/src/metadata/resource_loading.ts:157–173  ·  view source on GitHub ↗
(
  url: string,
  response: string | {text(): Promise<string>; status?: number},
)

Source from the content-addressed store, hash-verified

155}
156
157async 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}

Callers 1

cachedResourceResolveFunction · 0.85

Calls 1

textMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…