Version 1.7 glow.net.Response
API Quick Reference
JavaScript is required to use the quick reference
Provided in callbacks to glow.net.post and glow.net.get
Further Info & Examples
Constructor
There is no direct constructor, since glow.net.post and glow.net.get create the instances.
Properties
- nativeResponse
-
The response object from the browser.
- Type
Description
This may not have the same properties and methods across user agents.
- status
-
HTTP status code of the response
- Type
- timedOut
-
Boolean indicating if the requests time out was reached.
- Type
- wasSuccessful
-
Boolean indicating if the request returned successfully.
- Type
Methods
- header
-
Gets a header from the response
Synopsis
myResponse.header(name);
Parameters
- name
-
- Type
Header name
Returns
Header value
Example
var contentType = myResponse.header("Content-Type");
- json
-
Gets the body of the response as a json object
Synopsis
myResponse.json(safeMode);
Parameters
- safeMode
-
- Type
- Default
- false
- Optional
- Yes
If true, the response will be parsed using a string parser which will filter out non-JSON javascript, this will be slower but recommended if you do not trust the data source.
Returns
- statusText
-
Gets the meaning of myResponse.status
Synopsis
myResponse.statusText();
Returns
- text
-
Gets the body of the response as plain text
Synopsis
myResponse.text();
Returns
Response as text
- xml
-
Gets the body of the response as xml
Synopsis
myResponse.xml();
Returns
xml
Response as XML