Created
June 8, 2011 18:48
-
-
Save nmaier/1015051 to your computer and use it in GitHub Desktop.
test ignoreRedirect and redirectionLimit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @id test-ignore | |
// @name test-ignore | |
// @namespace tn123.org | |
// @include https://tn123.org/ | |
// ==/UserScript== | |
GM_xmlhttpRequest({ | |
method: "GET", | |
url: "https://tn123.org/somewhere", | |
ignoreRedirect: true, | |
onload: function(response) { | |
GM_log("ignoreRedirect: " + (response.finalUrl == "https://tn123.org/somewhere" ? "PASS" : "FAIL")); | |
} | |
}); | |
GM_xmlhttpRequest({ | |
method: "GET", | |
url: "https://tn123.org/somewhere", | |
onload: function(response) { | |
GM_log("redirect: " + (response.finalUrl == "http://www.iana.org/domains/example/" ? "PASS" : "FAIL")); | |
} | |
}); | |
GM_xmlhttpRequest({ | |
method: "GET", | |
url: "https://tn123.org/somewhere", | |
redirectionLimit: 0, | |
onload: function(response) { | |
GM_log("redirectionLimit: 0; FAIL"); | |
}, | |
onerror: function(response) { | |
GM_log("redirectionLimit: 0; PASS"); | |
} | |
}); | |
GM_xmlhttpRequest({ | |
method: "GET", | |
url: "https://tn123.org/somewhere", | |
failOnRedirect: true, | |
onload: function(response) { | |
GM_log("failOnRedirect; FAIL"); | |
}, | |
onerror: function(response) { | |
GM_log("failOnRedirect; PASS"); | |
} | |
}); | |
GM_xmlhttpRequest({ | |
method: "GET", | |
url: "https://tn123.org/somewhere", | |
redirectionLimit: 1, | |
onload: function(response) { | |
GM_log("redirectionLimit: 1; FAIL"); | |
}, | |
onerror: function(response) { | |
GM_log("redirectionLimit: 1; PASS"); | |
} | |
}); | |
GM_xmlhttpRequest({ | |
method: "GET", | |
url: "https://tn123.org/somewhere", | |
redirectionLimit: 10, | |
onload: function(response) { | |
GM_log("rediectonLimit: 10; PASS"); | |
}, | |
onerror: function(response) { | |
GM_log("rediectonLimit: 10; FAIL"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment