Skip to content

Fixture does not return correct datatype when error is thrown#129

Closed
mokkabonna wants to merge 1 commit intojupiterjs:masterfrom
mokkabonna:master
Closed

Fixture does not return correct datatype when error is thrown#129
mokkabonna wants to merge 1 commit intojupiterjs:masterfrom
mokkabonna:master

Conversation

@mokkabonna
Copy link

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
});

@mokkabonna mokkabonna closed this Jul 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant