HttpRequest

HttpRequest

new HttpRequest()

Source:

Extends

  • EventTarget

Members

(private) active_ :boolean

Description:
  • Whether XMLHttpRequest is active. A request is active from the time send() is called until onReadyStateChange() is complete, or error() or abort() is called.

Source:

Whether XMLHttpRequest is active. A request is active from the time send() is called until onReadyStateChange() is complete, or error() or abort() is called.

Type:
  • boolean

(private) completer_ :Completer

Description:
  • Completer which resolves the Promise returned by [send].

Source:

Completer which resolves the Promise returned by [send].

Type:
  • Completer

(private) eventKeys_ :Array.<Key>

Description:
  • Event keys for every eventlistener used inside this class.

Source:

Event keys for every eventlistener used inside this class.

Type:
  • Array.<Key>

headers :Map

Description:
  • Map of default headers to add to every request

Source:

Map of default headers to add to every request

Type:
  • Map

(private, nullable) lastResponseHeaders_ :Map

Description:
  • Response headers from the last request.

Source:

Response headers from the last request.

Type:
  • Map

(private, nullable) lastResponse_ :*

Description:
  • Response from the last request.

Source:

Response from the last request.

Type:
  • *

(private) lastUrl_ :string

Description:
  • Last URL that was requested.

Source:

Last URL that was requested.

Type:
  • string

responseType :string

Description:
  • The requested type for the response. The empty string means use the default XHR behavior.

Source:

The requested type for the response. The empty string means use the default XHR behavior.

Type:
  • string

timeout :number

Description:
  • Number of milliseconds after which an incomplete request will be aborted. 0 means no timeout is set.

Source:

Number of milliseconds after which an incomplete request will be aborted. 0 means no timeout is set.

Type:
  • number

withCredentials :boolean

Description:
  • Whether a "credentialed" request is to be sent (one that is aware of cookies and authentication). This is applicable only for cross-domain requests and more recent browsers that support this part of the HTTP Access Control standard.

Source:
See:

Whether a "credentialed" request is to be sent (one that is aware of cookies and authentication). This is applicable only for cross-domain requests and more recent browsers that support this part of the HTTP Access Control standard.

Type:
  • boolean

(private, nullable) xhr_ :XMLHttpRequest

Description:
  • The XMLHttpRequest object that is being used for the transfer.

Source:

The XMLHttpRequest object that is being used for the transfer.

Type:
  • XMLHttpRequest

Methods

abort()

Description:
  • Abort the current XMLHttpRequest

Source:

(private) cleanUpXhr_()

Description:
  • Remove the listeners to protect against leaks, and nullify the XMLHttpRequest object.

Source:

(protected) disposeInternal()

Source:

getLastUrl() → {string}

Description:
  • Gets the last URL that was requested

Source:
Returns:
Type
string

getResponse() → (nullable) {*}

Description:
  • Gets the last response of this XMLHttpRequest

Source:
Returns:
Type
*

getResponseHeaders() → (nullable) {Map}

Description:
  • Gets the last response headers of this XMLHttpRequest

Source:
Returns:
Type
Map

isActive() → {boolean}

Description:
  • Whether there is an active request.

Source:
Returns:
Type
boolean

(private) onDownloadProgress_(event)

Source:
Parameters:
Name Type Description
event BrowserEvent

(private) onLoad_()

Source:

(private) onTimeout_()

Source:

(private) onUploadProgress_(event)

Source:
Parameters:
Name Type Description
event BrowserEvent

(private) parseHeadersString_(string) → {Map}

Source:
Parameters:
Name Type Description
string string
Returns:
Type
Map

send(url, opt_methodopt, opt_data, opt_useropt, opt_passwordopt, opt_requestHeadersopt) → {Promise}

Description:
  • Function that actually uses XMLHttpRequest to make a server call.

Source:
Parameters:
Name Type Attributes Default Description
url string
opt_method string <optional>
GET
opt_data ArrayBuffer | ArrayBufferView | Blob | Document | FormData | string | Map null
opt_user string | null <optional>
null
opt_password string | null <optional>
null
opt_requestHeaders Map <optional>
null
Returns:
Type
Promise