jupiterjs/jquerymx — pull request #129 by mokkabonna (2012-05-23 12:05:32+00:00)
Title: Fixture does not return correct datatype when error is thrown

jQuery ajaxTransport does not accept datatype json when you return an error, leaving responseText empty.

$.fixture('POST /api/links', function() {
if(!data.Text) return [403, "Forbidden", { text: 'The field Title is required.'} , {}];
//etc
});

Fixture will modify this and send the following to ajaxTransport

403, 'Forbidden', {json:{text:'The field Title is required. ' }}, {}

While it should be

403, 'Forbidden', {text:'The field Title is required. ' }, {}

That way when you do

myrequest.fail(function(jqXHR){
console.log(jqXHR.responseText ) //Not undefined
});