Options
All
  • Public
  • Public/Protected
  • All
Menu

Implementation of IHttpClient for XMLHttpRequest

Hierarchy

  • XhrHttpClient

Implements

Index

Constructors

constructor

Properties

Private _headers

Private _ignoreCache

_ignoreCache: boolean

Private _timeout

_timeout: number

filters

filters: IHttpFilter[]

Collections of filters to use for the request/response

Static DefaultHeaders

DefaultHeaders: IHttpRequestHeaderCollection = new HttpRequestHeaderCollection(...[{name: KnownHeaderNames.accept,value: "application/json, text/javascript, text/plain"}])

The default headers to use. defaults to Accept: application/json, text/javascript, text/plain

Static DefaultIgnoreCache

DefaultIgnoreCache: boolean = false

The default ignoreCache parameter for XHR. default is false

Static DefaultTimeout

DefaultTimeout: number = 5000

The default timeout for requests. default is 5000ms

Methods

createRequest

getObjectAsync

  • getObjectAsync<T>(uri: string): Promise<T>
  • getObjectAsync<T>(uri: Url): Promise<T>
  • getObjectAsync<T>(uri: StringOrUrl): Promise<T>
  • Performs a get request to a JSON returning source and casts the object

    throws

    RequestCancelledException when the request is cancelled

    throws

    ServiceException if the response is cancelled or if there was a status code in the error range

    Type parameters

    • T

    Parameters

    • uri: string

      as string

    Returns Promise<T>

  • Performs a get request to a JSON returning source and casts the object

    throws

    RequestCancelledException when the request is cancelled

    throws

    ServiceException if the response is cancelled or if there was a status code in the error range

    Type parameters

    • T

    Parameters

    • uri: Url

      as Uri

    Returns Promise<T>

  • Performs a get request to a JSON returning source and casts the object

    throws

    RequestCancelledException when the request is cancelled

    throws

    ServiceException if the response is cancelled or if there was a status code in the error range

    Type parameters

    • T

    Parameters

    • uri: StringOrUrl

      as string or Uri

    Returns Promise<T>

postObjectAsync

  • postObjectAsync<TData, TResponseData>(uri: string, data: TData): Promise<TResponseData>
  • postObjectAsync<TData, TResponseData>(uri: Url, data: TData): Promise<TResponseData>
  • postObjectAsync<TData, TResponseData>(uri: StringOrUrl, data: TData): Promise<TResponseData>
  • Performs a post request to a JSON returning source and casts the object

    throws

    RequestCancelledException when the request is cancelled

    throws

    ServiceException if the response is cancelled or if there was a status code in the error range

    Type parameters

    • TData

    • TResponseData

    Parameters

    • uri: string

      as string

    • data: TData

    Returns Promise<TResponseData>

  • Performs a post request to a JSON returning source and casts the object

    throws

    RequestCancelledException when the request is cancelled

    throws

    ServiceException if the response is cancelled or if there was a status code in the error range

    Type parameters

    • TData

    • TResponseData

    Parameters

    • uri: Url

      as Uri

    • data: TData

    Returns Promise<TResponseData>

  • Performs a post request to a JSON returning source and casts the object

    throws

    RequestCancelledException when the request is cancelled

    throws

    ServiceException if the response is cancelled or if there was a status code in the error range

    Type parameters

    • TData

    • TResponseData

    Parameters

    • uri: StringOrUrl

      as string or Uri

    • data: TData

    Returns Promise<TResponseData>

Generated using TypeDoc