We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3771d17 commit 9b77acaCopy full SHA for 9b77aca
2 files changed
src/ajax.js
@@ -148,6 +148,7 @@
148
}
149
150
function mimeToDataType(mime) {
151
+ if (mime) mime = mime.split(';', 2)[0]
152
return mime && ( mime == htmlType ? 'html' :
153
mime == jsonType ? 'json' :
154
scriptTypeRE.test(mime) ? 'script' :
test/ajax.html
@@ -252,6 +252,19 @@ <h1>Zepto Ajax unit tests</h1>
252
$.ajax({ url: 'echo' })
253
},
254
255
+ testAjaxJSON: function(t){
256
+ t.pause()
257
+ resumeOnAjaxError(t)
258
+
259
+ $.ajax({
260
+ url: 'json',
261
+ headers: { accept: 'application/json' },
262
+ success: t.reg.resumeHandler('success', function(data){
263
+ t.assertEqual('world', data.hello)
264
+ })
265
266
+ },
267
268
testAjaxGetJSON: function(t){
269
t.pause()
270
resumeOnAjaxError(t)
0 commit comments