Support Menu

Class EndpointCaller

Class EndpointCaller

This class is in charge of calling an endpoint (eg: a SearchEndpoint).

This means it's only uses to execute an XMLHttpRequest (for example), massage the response and check if there are errors.

Will execute the call and return a Promise.

Call using one of those options :

  • XMLHttpRequest for recent browser that support CORS, or if the endpoint is on the same origin.
  • XDomainRequest for older IE browser that do not support CORS.
  • Jsonp if all else fails, or is explicitly enabled.

Index

Methods

call

  • Generic call to the endpoint using the provided IEndpointCallParameters.
    Internally, will decide which method to use to call the endpoint :
    -- XMLHttpRequest for recent browser that support CORS, or if the endpoint is on the same origin.
    -- XDomainRequest for older IE browser that do not support CORS.
    -- Jsonp if all else fails, or is explicitly enabled.

    Type parameters

    • T

    Parameters

    Returns Promise

    A promise of the given type

callUsingAjaxJsonP

  • callUsingAjaxJsonP<T>(requestInfo: IRequestInfo<T>): Promise

callUsingXDomainRequest

  • callUsingXDomainRequest<T>(requestInfo: IRequestInfo<T>): Promise

callUsingXMLHttpRequest

  • callUsingXMLHttpRequest<T>(requestInfo: IRequestInfo<T>, responseType?: string): Promise

Properties

useJsonp

useJsonp: boolean

Set this property to true to enable Jsonp call to the endpoint.
Be aware that jsonp is "easier" to setup endpoint wise, but has a lot of drawback and limitation for the client code.
Default to false.

type

{boolean}

Constructors

constructor

Hierarchy

  • EndpointCaller