kinetex - v1.0.0-rc.1
    Preparing search index...

    Function parseBody

    • Parse a raw body into a typed value. Uses content-type to select the parser:

      • application/json → JSON.parse
      • text/* → TextDecoder
      • otherwise → Uint8Array

      Type Parameters

      • T

      Parameters

      • raw: Uint8Array

        Raw body bytes

      • contentType: string | null

        Content-Type header value (or null)

      • OptionalcustomParser: (
            raw: Uint8Array,
            headers: Record<string, string>,
            url: string,
        ) => T | Promise<T>

        Optional custom parser function

      • OptionalonParseFailure: (raw: Uint8Array, error: Error) => void

        Called when JSON parsing fails before falling back to text

      • Optionalheaders: Record<string, string>

        Response headers (passed to customParser)

      • Optionalurl: string

        Request URL (passed to customParser)

      Returns T | Promise<T>

      Parsed body value (T, string, or Uint8Array)