Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ajax: fix parsing response Content-Type from the server

Fixes #699
  • Loading branch information...
commit 9b77aca0349903aecc820c028580428896df6832 1 parent 3771d17
@mislav mislav authored
Showing with 14 additions and 0 deletions.
  1. +1 −0  src/ajax.js
  2. +13 −0 test/ajax.html
View
1  src/ajax.js
@@ -148,6 +148,7 @@
}
function mimeToDataType(mime) {
+ if (mime) mime = mime.split(';', 2)[0]
return mime && ( mime == htmlType ? 'html' :
mime == jsonType ? 'json' :
scriptTypeRE.test(mime) ? 'script' :
View
13 test/ajax.html
@@ -252,6 +252,19 @@
$.ajax({ url: 'echo' })
},
+ testAjaxJSON: function(t){
+ t.pause()
+ resumeOnAjaxError(t)
+
+ $.ajax({
+ url: 'json',
+ headers: { accept: 'application/json' },
+ success: t.reg.resumeHandler('success', function(data){
+ t.assertEqual('world', data.hello)
+ })
+ })
+ },
+
testAjaxGetJSON: function(t){
t.pause()
resumeOnAjaxError(t)
Please sign in to comment.
Something went wrong with that request. Please try again.