Class: Config

Rest#Config

new Config()

The default configuration options

Properties:
Name Type Attributes Description
baseUrl String

The base URL for requests. I.e, if the baseUrl is set to http://google.com, all requests will be prefixed with http://google.com

defaultParams Object

The default parameters for requests. Can be overriden by specific requests

fields Object

The special fields used to determine url (and later, header) information

Properties
Name Type Description
id Object

The property that RestJS should use as the id. This will be used for subsequent requests, such as DELETE, PUT or PATCH requests: <baseUrl>/<resource>/<id field>

headers Array.<Array.<String>>

The default headers for requests, defaults to an empty array, expected elements: [String, String]

responseType String

The response type for the request. See the docs for XMLHttpRequest.responseType

timeout number <optional>

The XHR timeout. See the docs for XMLHttpRequest.timeout

withCredentials boolean <optional>

Whether to send CORS credentials with the request or not. See the docs for XMLHttpRequest.withCredentials

Source:

Methods

(static) Rest.Config.set(config)

Sets a given config to the configuration object

Parameters:
Name Type Description
config Object

The specified config

Source:
Example
Rest.Config.set({baseUrl: 'https://restjs.js.org'})