Skip to content

Instantly share code, notes, and snippets.

@mataspetrikas
Created June 14, 2011 13:38
Show Gist options
  • Save mataspetrikas/1024911 to your computer and use it in GitHub Desktop.
Save mataspetrikas/1024911 to your computer and use it in GitHub Desktop.
Mockjax remote jsonp failure
asyncTest('Response returns jsonp', function() {
$.mockjax({
url: 'http://example.com/jsonp*',
contentType: 'text/json',
proxy: 'test_jsonp.js'
});
window.abcdef123456 = function(json) {
ok( true, 'JSONP Callback executed');
deepEqual(json, { "data" : "JSONP is cool" });
};
$.ajax({
url: 'http://example.com/jsonp?callback=?',
jsonpCallback: 'abcdef123456',
dataType: 'jsonp',
error: noErrorCallbackExpected,
complete: function(xhr) {
equals(xhr.getResponseHeader('Content-Type'), 'text/json', 'Content type of text/json');
start();
}
});
$.mockjaxClear();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment