RequestBody

RequestBody

new RequestBody(options)

RequestBody holds data related to the request body. By default, it provides a nice wrapper for url-encoded, form-data, and raw types of request bodies.

Parameters:
Name Type Description
options Object
Source:

Extends

Members

(static) MODES :string

MODES

Type:
  • string
Properties:
Name Type Description
raw string
formdata string
urlencoded string
file string
Source:

file

Holds a reference to a file which should be read as the RequestBody. It can be a file path (when used with Node) or a unique ID (when used with the browser).

Source:

formdata :PropertyList.<FormParam>

Form data parameters for this request are held in this field.

Type:
Source:

mode :String

Indicates the type of request data to use.

Type:
  • String
Source:

raw :String

If the request has raw body data associated with it, the data is held in this field.

Type:
  • String
Source:

urlencoded :PropertyList.<QueryParam>

Any URL encoded body params go here.

Type:
Source:

Methods

findInParents(property, customizeropt) → {*|undefined}

Tries to find the given property locally, and then proceeds to lookup in each parent, going up the chain as necessary. Lookup will continue until customizer returns a truthy value. If used without a customizer, the lookup will stop at the first parent that contains the property.

Parameters:
Name Type Attributes Description
property String
customizer function <optional>
Inherited From:
Source:
Returns:
Type
* | undefined

forEachParent(optionsopt, iterator)

Invokes the given iterator for every parent in the parent chain of the given element.

Parameters:
Name Type Attributes Default Description
options Object | Boolean <optional>
{}

A set of options for the parent chain traversal.

Properties
Name Type Attributes Default Description
withRoot Boolean <optional>
<nullable>
false

Set to true to include the collection object as well.

iterator function

The function to call for every parent in the ancestry chain.

Inherited From:
Source:
To Do:
  • Cache the results

isEmpty() → {Boolean}

If the request body is set to a mode, but does not contain data, then we should not be sending it.

Source:
Returns:
Type
Boolean

meta() → {*}

Returns the meta keys associated with the property

Inherited From:
Source:
Returns:
Type
*

parent() → {*|undefined}

Returns the parent of item

Inherited From:
Source:
Returns:
Type
* | undefined

toJSON()

Returns the JSON representation of a property, which conforms to the way it is defined in a collection. You can use this method to get the instantaneous representation of any property, including a Collection.

Inherited From:
Source:

toString() → {*}

Stringifies and returns the request body.

Source:
Returns:
Type
*

update(options)

Set the content of this request data

Parameters:
Name Type Description
options Object
Source: