API Docs for: 0.0.8
Show:

Xhr Class

Provides XHR functionality for use in either a browser or node environment.

Item Index

Methods

Methods

get

(
  • path endpoint
  • [data]
  • [options={}]
)
Promise

Perform a GET request

Parameters:

  • path endpoint String

    URL

  • [data] Object | | String optional

    data to send

  • [options={}] Object optional

    Options

    • [contentType] String optional

      Content type of data. Defaults to application/json

    • [headers] Object optional

      Headers to pass with request.

    • [xhr] Object optional

      XMLHttpRequest compatible object to use for XHR requests

Returns:

Promise:

A promise that will be fulfilled with JSON xhr.responseText of the request

post

(
  • path endpoint
  • [data]
  • [options={}]
)
Promise

Perform a POST request

Parameters:

  • path endpoint String

    URL

  • [data] Object | | String optional

    data to send

  • [options={}] Object optional

    Options

    • [contentType] String optional

      Content type of data. Defaults to application/json

    • [headers] Object optional

      Headers to pass with request.

    • [xhr] Object optional

      XMLHttpRequest compatible object to use for XHR requests

Returns:

Promise:

A promise that will be fulfilled with JSON xhr.responseText of the request