Skip to main content

HttpResponseType

Used with get to convert responses to correct data. See get for an example.

Index

Properties

publicreadonlyarrayBuffer

arrayBuffer: (r: Response) => TypedResponse<ArrayBuffer>

Type declaration

    • Converts an array buffer Response to TypedResponse

      <ArrayBuffer>
      .


      Parameters

      • r: Response

      Returns TypedResponse<ArrayBuffer>

publicreadonlyblob

blob: (r: Response) => TypedResponse<Blob>

Type declaration

    • Converts a blob Response to TypedResponse

      <Blob>
      .


      Parameters

      • r: Response

      Returns TypedResponse<Blob>

publicreadonlyempty

empty: (r: Response) => TypedResponse<undefined>

Type declaration

    • Converts an empty Response to TypedResponse

      <undefined>
      .


      Parameters

      • r: Response

      Returns TypedResponse<undefined>

publicreadonlyjson

json: <T>(r: Response) => TypedResponse<T>

Type declaration

publicreadonlytext

text: (r: Response) => TypedResponse<string>

Type declaration

    • Converts a text Response to TypedResponse

      <string>
      .


      Parameters

      • r: Response

      Returns TypedResponse<string>

publicstaticreadonlydefault

default: HttpResponseType = ...

By default, value conversion methods only assign value when Response.status === 200

Methods

publicstaticarrayBuffer

  • Converts an array buffer Response to TypedResponse

    <ArrayBuffer>
    .


    Parameters

    • r: Response

    Returns TypedResponse<ArrayBuffer>

publicstaticblob

  • Converts a blob Response to TypedResponse

    <Blob>
    .


    Parameters

    • r: Response

    Returns TypedResponse<Blob>

publicstaticjson

publicstaticstatus

  • Default is that value is only valid if Response.status === 200 for responses sent into arrayBuffer, json, text and blob. Call this method to create a custom HttpResponseType where value can be assigned for other status values as well. Example: A conflict response may still contain data which should be assigned to value.


    Parameters

    • statuses: number[]

    Returns HttpResponseType

publicstatictext

  • Converts a text Response to TypedResponse

    <string>
    .


    Parameters

    • r: Response

    Returns TypedResponse<string>