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
file string
formdata string
graphql string
raw string
urlencoded string
Source:

disabled :Boolean

Indicates whether to include body in request or not.

Type:
  • Boolean
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:

graphql :Object

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

Type:
  • Object
Source:

mode :String

Indicates the type of request data to use.

Type:
  • String
Source:

options :Object

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

Type:
  • Object
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(options, iterator)

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

Parameters:
Name Type Description
options Object

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() → {Object}

Convert the request body to JSON compatible plain object

Overrides:
Source:
Returns:
Type
Object

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:

Type Definitions

definition

Properties:
Name Type Description
mode String
raw String
file String
graphql Object
formdata Array.<Object>
urlencoded Array.<Object> | String
Source: