requestHandler
requestHandler(request, response(...), requestHeaders, ajaxSettings)
Defines the XHR response for a given trapped request.
fixture( { method: "get", url: "/todos" },
function( request, response, headers, ajaxSettings ) {
request; //-> {
// method: "get",
// url: "/todos",
// data: {complete: true}
// }
}
);
$.ajax( { method: "get", url: "/todos?complete=true" } );
Templated url
data will be added to the requestHandler
's request
argument's data
property:
fixture( { url: "/todos/{action}" },
function( request, response, headers, ajaxSettings ) {
request; //-> {
// method: "post",
// url: "/todos",
// data: {action: delete}
// }
}
);
$.post( "/todos/delete" );
Parameters
- request
{request}
:Information about the request. The request's data property will contain data from the request's querystring or request body. Also any templated values in the ajaxSettings's
url
will be added. - response
{response()}
:A callback function that provides response information.
- requestHeaders
{Object}
:Headers used to make the request.
- ajaxSettings
{Object}
:The settings object used to match this request.