Request

Request

new Request(options)

Defines an object to provide client request information to the underlying client library.

Parameters:
Name Type Description
options Object

Request options object

Properties
Name Type Description
method String

Request method verb

Author:
  • Nijiko Yonskai
Source:

Members

(private) _headers :Headers

The request headers hashmap.

Type:
Source:

(private) _method :String

The request method verb.

Type:
  • String
Source:

(private) _query :Query

The request query hashmap.

Type:
Source:

(private) _uri :String

The request uri.

Type:
  • String
Source:

Methods

hasHeader(key) → {String|Boolean}

Returns original key if this map contains a mapping for the specified key with a case insensitive check, otherwise returns false.

Parameters:
Name Type Description
key String

Specified key to evaluate existance of.

Source:
See:
Returns:
Type
String | Boolean

hasQueryParameter(key) → {String|Boolean}

Returns original key if this map contains a mapping for the specified key with a case insensitive check, otherwise returns false.

Parameters:
Name Type Description
key String

Specified key to evaluate existance of.

Source:
See:
Returns:
Type
String | Boolean

Associates the specified value with the specified key in the Request#_headers mapping.

When an arity of one argument is passed, the specified argument is treated as a collection and passed to Header#putAll().

Parameters:
Name Type Description
key Object | HeaderString | Header | HashMap
value Object
Source:
Returns:
Type
this

headers() → {this}

Alias for Request#header

Source:
Returns:
Type
this

qs() → {this}

Alias for Request#query

Source:
Returns:
Type
this

query(key, value) → {this}

Associates the specified value with the specified key in the Request#_query mapping.

When an arity of one argument is passed, the specified argument is treated as a collection and passed to Query#putAll().

Parameters:
Name Type Description
key Object | HeaderString | Query | HashMap
value Object
Source:
Returns:
Type
this

queryString() → {this}

Alias for Request#query

Source:
Returns:
Type
this

set() → {this}

Alias for Request#header

Source:
Returns:
Type
this

setMashapeKey(value) → {this}

Associates the specified value as the X-Mashape-Authorization header in the Request#_headers mapping.

Parameters:
Name Type Description
value String

Mashape Application Key

Source:
Returns:
Type
this

toRequestOptions() → {Object}

Returns a JSON representation of this object for the request library.

Source:
See:
  • Request#end
Returns:

JSON representation

Type
Object

type(value) → {this}

Associates the specified value as the Content-Type header in the Request#_headers mapping.

When type value does not contain a forward slash a mimetype lookup is done to get the appropriate mimetype string using the mime module.

Parameters:
Name Type Description
value String

Specified content type value

Source:
Returns:
Type
this