can-fixture
Advanced tools
Comparing version 3.0.0-pre.10 to 3.0.0-pre.11
15
core.js
@@ -173,2 +173,9 @@ // Adds | ||
function FixtureResponse(fixture, response){ | ||
this.statusCode= response[0]; | ||
this.responseBody= response[1]; | ||
this.headers= response[2]; | ||
this.statusText= response[3]; | ||
this.fixture= fixture; | ||
} | ||
@@ -180,9 +187,7 @@ // Calls a dynamic fixture and calls `cb` with the response data. | ||
//!steal-remove-start | ||
var json = JSON.stringify(xhrSettings.data); | ||
canLog.log("" + xhrSettings.type.toUpperCase() + " " + xhrSettings.url+" "+json.substr(0,50)+" -> handler(req,res)"); | ||
//!steal-remove-end | ||
var response = function(){ | ||
var res = exports.extractResponse.apply(xhrSettings, arguments); | ||
//!steal-remove-start | ||
canLog.log("can-fixture: " + xhrSettings.type.toUpperCase() + " " + xhrSettings.url+" ",xhrSettings.data," => ",new FixtureResponse(fixtureSettings.fixture,res)); | ||
//!steal-remove-end | ||
return cb.apply(this, res); | ||
@@ -189,0 +194,0 @@ }; |
{ | ||
"name": "can-fixture", | ||
"version": "3.0.0-pre.10", | ||
"version": "3.0.0-pre.11", | ||
"description": "Intercept AJAX requests and simulate responses.", | ||
@@ -5,0 +5,0 @@ "main": "fixture.js", |
@@ -1948,2 +1948,2 @@ require("./matches-test"); | ||
}); | ||
} | ||
} // END onabort check |
@@ -237,3 +237,3 @@ /* global require, window, global */ | ||
if(fixtureSettings && typeof fixtureSettings.fixture === "number") { | ||
canLog.log(xhrSettings.url+" -> delay " + fixtureSettings.fixture+"ms"); | ||
canLog.log("can-fixture: "+xhrSettings.url+" => delay " + fixtureSettings.fixture+"ms"); | ||
this.timeoutId = setTimeout(makeRequest, fixtureSettings.fixture); | ||
@@ -245,3 +245,3 @@ return; | ||
if(fixtureSettings) { | ||
canLog.log(xhrSettings.url+" -> " + fixtureSettings.url); | ||
canLog.log("can-fixture: "+xhrSettings.url+" => " + fixtureSettings.url); | ||
canReflect.assignMap(mockXHR, fixtureSettings); | ||
@@ -248,0 +248,0 @@ } |
111394
2845