A chainable object for further configuration
An Ajax GET request.
$t.get("/get-test")
.set("Accept", "text/html")
.end(function(res) {
assert.equal("Sample text", res.responseText);
});
The URL to request
The Ajax request options
A chainable object for further configuration
A jsonp request. Example:
var url = "http://feeds.delicious.com/v1/json/";
url += "alex_young/javascript?callback={callback}";
connectsdk.net.jsonp(url, {
success: function(json) {
console.log(json);
}
});
The URL to request
Parses JSON represented as a string.
The original string
A JavaScript object
Parses XML represented as a string.
A JavaScript object
An Ajax POST request.
$t.post("/post-test")
.data({ key: "value" })
.end(function(res) {
assert.equal("value", res.responseText);
});
The URL to request
The Ajax request options (postBody
may come in handy here)
An object for further chaining with promises
Serialize JavaScript for HTTP requests.
An Array or Object
A string suitable for a GET or POST request
Creates an Ajax request. Returns an object that can be used to chain calls. For example:
$t.post("/post-test") .data({ key: "value" }) .end(function(res) { assert.equal("value", res.responseText); }); $t.get("/get-test") .set("Accept", "text/html") .end(function(res) { assert.equal("Sample text", res.responseText); });
The available chained methods are:
set
-- set a HTTP headerdata
-- the postBodyend
-- send the request over the network, and calls your callback with ares
objectsend
-- sends the request and callsdata
:.send({ data: value }, function(res) { });