Response

Response

new Response(response)

A representation of the request response object.

Parameters:
Name Type Description
response Object

Response object from Request

Author:
  • Nijiko Yonskai
Source:

Members

accepted :Boolean

Flag describing whether response contains the Accepted status code (202).

Type:
  • Boolean
Source:

badRequest :Boolean

Flag describing whether response contains the BAD REQUEST status code (400).

Type:
  • Boolean
Source:

body :Object

The response body, marshalled by content type

Type:
  • Object
Source:

clientError :Boolean

Flag describing whether response was within the Client Error status code range, (4xx).

Type:
  • Boolean
Source:

cookies :HashMap

The response cookie hashmap.

Type:
Source:

error :Boolean|StatusError

Flag describing whether response within an ERROR status code range (4xx - 5xx).

Type:
Source:

forbidden :Boolean

Flag describing whether response has the FORBIDDEN status code (403).

Type:
  • Boolean
Source:

headers :Headers

The response headers hashmap.

Type:
Source:

info :Boolean

Flagescribing whether response was within the INFO status code range, (1xx).

Type:
  • Boolean
Source:

noContent :Boolean

Flag describing whether response contains the NO CONTENT status code (204).

Type:
  • Boolean
Source:

notAcceptable :Boolean

Flag describing whether response has the NOT ACCEPTABLE status code (406).

Type:
  • Boolean
Source:

notFound :Boolean

Flag describing whether response has the NOT FOUND status code (404).

Type:
  • Boolean
Source:

ok :Boolean

Flag describing whether response was within the OK status code range, (2xx).

Type:
  • Boolean
Source:

rawBody :Object|String

The raw response body.

Type:
  • Object | String
Source:

redirection :Boolean

Flag describing whether response was within the Redirect status code range, (3xx).

Type:
  • Boolean
Source:

serverError :Boolean

Flag describing whether response was within the Server Error status code range, (4xx).

Type:
  • Boolean
Source:

statusRange :Number

Status code range

Type:
  • Number
Source:

unauthorized :Boolean

Flag describing whether response has the UNAUTHORIZED status code (401).

Type:
  • Boolean
Source:

Methods

Retrieves value of the specified key from cookies hashmap.

Parameters:
Name Type Description
key String
Source:
Returns:
Type
Object

type(parse) → {String}

Returns the Content-Type header as specified in the response headers, by specifying the parse flag only the value before the first semicolon is returned.

Should the content-type header be unavailable 'application/octet-stream' is returneded as per the HTTP Spec: http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.2.1

Parameters:
Name Type Description
parse Boolean

Mime type parsing flag

Source:
Returns:
Type
String