Skip to content

Instantly share code, notes, and snippets.

@rogeriochaves
Created May 8, 2015 17:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogeriochaves/ad633f47dab497a84ad0 to your computer and use it in GitHub Desktop.
Save rogeriochaves/ad633f47dab497a84ad0 to your computer and use it in GitHub Desktop.
Make ajax request fail
(function (originalOpen) {
XMLHttpRequest.prototype.open = function (method, url, async, user, password) {
if (url.match(/limits/)) url = "REJECTED";
originalOpen.call(this, method, url, async, user, password);
};
})(XMLHttpRequest.prototype.open);
@rogeriochaves
Copy link
Author

Run this on the console, before the requests are made

@roberto
Copy link

roberto commented May 8, 2015

Expected 'use strict' before 'XMLHttpRequest'.
Expected '{' and instead saw 'url'.

@rogeriochaves
Copy link
Author

@roberto REJECTED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment