DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
  • Ecosystem
    • can-construct-super
    • can-define-stream
    • can-fixture
      • types
        • Store
        • ajaxSettings
        • request
        • requestHandler
        • response
      • properties
        • delay
        • on
        • rand
        • store
    • can-fixture-socket
    • can-jquery
    • can-stache-converters
    • can-stream
    • can-vdom
    • can-view-import
    • can-zone
    • steal-stache
  • Infrastructure
  • Legacy
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Ecosystem
  • /
  • can-fixture
  • /
  • request
  • / On this page
    • request

      typedef

      An object with easily digestible values derived from the mock XHR object.

      • source

      Object

      This object is passed to a requestHandler and can be used to determine the response.

      fixture("GET /todos/{id}", function(request, response){
          request.url     //-> "todos/5"
          request.method  //-> "get"
          request.data    //-> {id: "5", include: ["owner"]}
          request.headers //-> {}
          request.async   //-> false
      });
      
      $.get("/todos/5?include[]=owner");
      

      Options

      • url {String}:

        The requested url with anything after the querystring taken off in GET and DESTROY method requests.

      • method {String}:

        The method of the request. Ex: GET, PUT, POST, etc.

      • data {Object}:

        The data of the querystring or the data to XMLHTTPRequest.prototype.send converted back to JavaScript objects with either JSON.stringify or deparam.

      • headers {Object}:

        Headers added to the XHR object with XMLHTTPRequest.prototype.setRequestHeader.

      • async {Boolean}:

        true if the request was a synchronous request.

      • xhr {XMLHTTPRequest}:

        The mock xhr request.

      CanJS is part of DoneJS. Created and maintained by the core DoneJS team and Bitovi. Currently 3.0.0.