Amazon Vinyl
    Preparing search index...

    Function readResponseBody

    • Reads a response body, classifying a read failure with a service error origin.

      The requester (requestWithRetry/request) classifies only the fetch and the response status; it returns the Response before the body is consumed. Reading the body stream can fail after a successful response — e.g. the connection drops mid-body — rejecting with a bare TypeError ("Failed to fetch") that carries no origin and would otherwise be reported with ReportableError's internal default. This reads the body on the caller's behalf and rethrows such failures as a ReportableError with a service origin (mirroring RequestError origin classification: a 5xx status is serviceExternal, anything else serviceInternal). An aborted read is preserved as a silent error so an intentional cancellation is not reported.

      Parameters

      • response: Response
      • as: "arrayBuffer"

      Returns Promise<ArrayBuffer>

    • Reads a response body, classifying a read failure with a service error origin.

      The requester (requestWithRetry/request) classifies only the fetch and the response status; it returns the Response before the body is consumed. Reading the body stream can fail after a successful response — e.g. the connection drops mid-body — rejecting with a bare TypeError ("Failed to fetch") that carries no origin and would otherwise be reported with ReportableError's internal default. This reads the body on the caller's behalf and rethrows such failures as a ReportableError with a service origin (mirroring RequestError origin classification: a 5xx status is serviceExternal, anything else serviceInternal). An aborted read is preserved as a silent error so an intentional cancellation is not reported.

      Parameters

      • response: Response
      • as: "text"

      Returns Promise<string>

    • Reads a response body, classifying a read failure with a service error origin.

      The requester (requestWithRetry/request) classifies only the fetch and the response status; it returns the Response before the body is consumed. Reading the body stream can fail after a successful response — e.g. the connection drops mid-body — rejecting with a bare TypeError ("Failed to fetch") that carries no origin and would otherwise be reported with ReportableError's internal default. This reads the body on the caller's behalf and rethrows such failures as a ReportableError with a service origin (mirroring RequestError origin classification: a 5xx status is serviceExternal, anything else serviceInternal). An aborted read is preserved as a silent error so an intentional cancellation is not reported.

      Parameters

      • response: Response
      • as: "json"

      Returns Promise<any>