Object
This object is used to match values on request objects.
If there's a match, the fixture handler provided with the
ajaxSettings will be invoked.
If a property on an ajaxSettings is not provided, all request values
will be matched for that property.
For example,
you can match all GET requests, no matter what url is passed like:
fixture({method: "GET"}, function(){ ... });
Options
-
url
{String}:
The requested url with anything after the querystring taken off in GET and DESTROY method requests. For example, you can't match:
fixture({method: "GET", url: "/things?name=Justin"});
Instead write:
fixture({method: "GET", url: "/things", data: {name: "Justin"}});
The url can have templates like:
fixture({method: "GET", url: "/things/{id}"})
The templated values get added to the request object's data.
-
method
{String}:
The method of the request. Ex: GET, PUT, POST, etc. Capitalization is ignored.
-
data
{Object}:
Match the data of the request. The data of the querystring or the data to XMLHTTPRequest.prototype.send is converted to a JavaScript objects with either JSON.stringify or deparam. The data must match part of the request's data.
-
async
{Boolean}:
Write true to match asynchronous requests only.