MCPcopy Index your code
hub / github.com/angular/angular / _toArrayBufferBody

Function _toArrayBufferBody

packages/common/http/testing/src/request.ts:148–158  ·  view source on GitHub ↗

* Helper function to convert a response body to an ArrayBuffer.

(
  body: ArrayBuffer | Blob | string | number | Object | (string | number | Object | null)[],
)

Source from the content-addressed store, hash-verified

146 * Helper function to convert a response body to an ArrayBuffer.
147 */
148function _toArrayBufferBody(
149 body: ArrayBuffer | Blob | string | number | Object | (string | number | Object | null)[],
150): ArrayBuffer {
151 if (typeof ArrayBuffer === 'undefined') {
152 throw new Error('ArrayBuffer responses are not supported on this platform.');
153 }
154 if (body instanceof ArrayBuffer) {
155 return body;
156 }
157 throw new Error('Automatic conversion to ArrayBuffer is not supported for response type.');
158}
159
160/**
161 * Helper function to convert a response body to a Blob.

Callers 1

_maybeConvertBodyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…