Namespace puredom.net
-
Networking functionality.
- Defined in: net.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
Method Summary
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
puredom.net.
get
(url, callback, options)
Make a GET request.
|
| <static> |
puredom.net.
post
(url, body, callback, options)
Make a POST request.
|
| <static> |
puredom.net.
request
(options, callback)
Construct and send an HTTP request based on the specified options.
|
Namespace Detail
puredom.net
Method Detail
-
Make a GET request.
This is a convenience wrapper around puredom.net.request.puredom.net.get("/ajax?f=1", function(success, response) { console.log(success===true, response); });- Parameters:
- {String} url
- URL to request
- {Function} callback
- Called on completion. Gets passed
(success, response, request). - {Object} options Optional
- Additional configuration. See options for puredom.net.request.
- Returns:
- {puredom.net.HttpRequest} An HTTP request object
-
Make a POST request.
This is a convenience wrapper around puredom.net.request.puredom.net.get("/ajax?f=2", { foo:'bar' }, function(success, res, req) { console.log(success===true, res, req.status, req.responseHeaders); });- Parameters:
- {String} url
- URL to request
- {Object|String} body
- Request body. If an
Object, will be serialized based on the request's Content-Type (defaulting to form-encoded) - {Function} callback
- Called on completion. Gets passed
(success, response, request). - {Object} options Optional
- Additional configuration. See options for puredom.net.request.
- Returns:
- {puredom.net.HttpRequest} An HTTP request object
-
Construct and send an HTTP request based on the specified options.
- Parameters:
- {Object} options
- Request options.
- {String} options.url
- URL to request
- {String} options.method Optional, Default: "GET"
- HTTP method to use
- {String|Object} options.body Optional
- Request body. If a
Stringis passed, it is considered pre-serialized. If anObjectis passed, it will be serialized based on the request'sContent-Typeheader. - {Any} options.bodySerialized Optional
- If set, gets assigned unmodified as the request body. If you're sending something like Blob data, this is for you.
- {Object} options.headers Optional
- A key-value list of request headers to send.
- {Object} options.contentTypeOverride Optional
- If set, overrides the response's
Content-Typeheader with the given value. - {Object} options.callback Optional
- Alias of
callback, a function to call on completion. Gets passed(success, response, request). - {Function} callback Optional
- Called on completion. Gets passed
(success, response, request). If set, takes precidence overoptions.callback.
- Returns:
- {puredom.net.HttpRequest} An HTTP request object