code: function (params) {
      var resourceObject = {
        url: resource.url(),
        method: method,
        headers: resource.headers
      };
      
      if (typeof params === 'object') {
        resourceObject.json = true;
        resourceObject.body = params;
      }
      else if (typeof params === 'string') {
        resourceObject.body = params;
      }
      
      // Should this resource be mocked, or real?
      // It is ensured that you can define the mock before
      // or after the resource is defined
      var mock = self.mock(method, uri);
      if (mock) {
        mock.request = {
          body: params,
          method: method,
          pathname: slash(uri),
          headers: resource.headers
        };
        return mock.fn()();
      }
      else {
        return rawHttp(extend(resourceObject, resource.xhrOptions || {}));
      }
    }
docs: New resource object