jasmine-ajax
Advanced tools
Comparing version 2.99.0 to 3.0.0
{ | ||
"name": "jasmine-ajax", | ||
"version": "2.0.1", | ||
"homepage": "https://github.com/pivotal/jasmine-ajax", | ||
"description": "A library for faking Ajax responses in your Jasmine suite.", | ||
"version": "3.0.0", | ||
"main": "lib/mock-ajax.js", | ||
"license": "MIT", | ||
"homepage": "https://github.com/jasmine/jasmine-ajax", | ||
"authors": [ | ||
@@ -9,4 +13,2 @@ "JR Boyens <jboyens@fooninja.org>", | ||
], | ||
"description": "A library for faking Ajax responses in your Jasmine suite.", | ||
"main": "lib/mock-ajax.js", | ||
"dependencies": { | ||
@@ -22,3 +24,2 @@ "jasmine" : "~2.0" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
@@ -28,12 +29,10 @@ "**/.*", | ||
"Gemfile.lock", | ||
"Gruntfile", | ||
"Gruntfile.js", | ||
"Rakefile", | ||
"app/bower_components", | ||
"bower_components", | ||
"node_modules", | ||
"spec", | ||
"test", | ||
"tests", | ||
"src", | ||
"travis-script.sh" | ||
] | ||
} |
@@ -86,2 +86,12 @@ /* | ||
function unconvertibleResponseTypeMessage(type) { | ||
var msg = [ | ||
"Can't build XHR.response for XHR.responseType of '", | ||
type, | ||
"'.", | ||
"XHR.response must be explicitly stubbed" | ||
]; | ||
return msg.join(' '); | ||
} | ||
function fakeRequest(global, requestTracker, stubTracker, paramParser) { | ||
@@ -251,14 +261,27 @@ function FakeXMLHttpRequest() { | ||
} | ||
return responseHeaders.join('\r\n'); | ||
return responseHeaders.join('\r\n') + '\r\n'; | ||
}, | ||
responseText: null, | ||
response: null, | ||
responseType: null, | ||
response: function(response) { | ||
if (window.console && window.console.warn) { | ||
window.console.warn("jasmine-ajax's response method is deprecated because it conflicts with XmlHTTPRequest 2 sytax. It will be removed in a later version. Please use respondWith"); | ||
responseValue: function() { | ||
switch(this.responseType) { | ||
case null: | ||
case "": | ||
case "text": | ||
return this.readyState >= 3 ? this.responseText : ""; | ||
case "json": | ||
return JSON.parse(this.responseText); | ||
case "arraybuffer": | ||
throw unconvertibleResponseTypeMessage('arraybuffer'); | ||
case "blob": | ||
throw unconvertibleResponseTypeMessage('blob'); | ||
case "document": | ||
return this.responseXML; | ||
} | ||
this.respondWith(response); | ||
}, | ||
respondWith: function(response) { | ||
@@ -271,6 +294,16 @@ if (this.readyState === 4) { | ||
this.responseText = response.responseText || ""; | ||
this.responseType = response.responseType || ""; | ||
this.readyState = 4; | ||
this.responseHeaders = normalizeHeaders(response.responseHeaders, response.contentType); | ||
this.responseXML = getResponseXml(response.responseText, this.getResponseHeader('content-type') || ''); | ||
if (this.responseXML) { | ||
this.responseType = 'document'; | ||
} | ||
if ('response' in response) { | ||
this.response = response.response; | ||
} else { | ||
this.response = this.responseValue(); | ||
} | ||
this.onreadystatechange(); | ||
@@ -437,2 +470,3 @@ this.events.progress(); | ||
this.contentType = options.contentType; | ||
this.response = options.response; | ||
this.responseText = options.responseText; | ||
@@ -439,0 +473,0 @@ }; |
{ | ||
"name": "jasmine-ajax", | ||
"description": "A library for faking Ajax responses in your Jasmine suite", | ||
"url": "https://github.com/pivotal/jasmine-ajax", | ||
"version": "3.0.0", | ||
"main": "lib/mock-ajax.js", | ||
"version": "2.99.0", | ||
"license": "MIT", | ||
"url": "https://github.com/jasmine/jasmine-ajax", | ||
"contributors": [ | ||
"Gregg Van Hove <gregg@slackersoft.net>", | ||
"JR Boyens <jboyens@fooninja.org>" | ||
], | ||
"private": false, | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/pivotal/jasmine-ajax" | ||
"url": "https://github.com/jasmine/jasmine-ajax" | ||
}, | ||
@@ -13,0 +18,0 @@ "dependencies": {}, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
2
32132
8
519
1