request
An object with easily digestible values derived from the mock XHR object.
Object
This object is passed to a requestHandler and can be used to determine the response.
import {fixture, ajax} from "can";
fixture( "GET /todos/{id}", ( request, response ) => {
console.log( request.url ); //-> "todos/5"
console.log( request.method ); //-> "get"
console.log( request.data ); //-> {id: "5", include: ["owner"]}
console.log( request.headers ); //-> {Accept: "*/*", X-Requested-With: "XMLHttpRequest"}
console.log( request.async ); //-> false
return;
} );
ajax( {url: "/todos/5?include[]=owner"} );