-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
def main(request, response): | ||
if request.method == "POST": | ||
response.add_required_headers = False | ||
response.writer.write_status(302) | ||
response.writer.write_header("Location", request.url) | ||
response.writer.end_headers() | ||
response.writer.write("") | ||
elif request.method == "GET": | ||
return ([("Content-Type", "text/plain")], | ||
"OK") | ||
else: | ||
return ([("Content-Type", "text/plain")], | ||
"FAIL") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<!-- Step 1: send POST request to a URL which will then 302 Found redirect --> | ||
<title>HTTP 302 Found POST Navigation Test</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
async_test(function(t) { | ||
window.addEventListener("load", function() { | ||
var frame = document.getElementById("frame"); | ||
var link = new URL("302-found-post-handler.py", window.location.href); | ||
frame.contentWindow.document.body.innerHTML = '<form action="' + link.href + '" method="POST" id="form"><input name="n"></form>'; | ||
frame.contentWindow.document.getElementById("form").submit(); | ||
frame.addEventListener("load", t.step_func_done(function() { | ||
assert_equals(frame.contentWindow.document.body.textContent, "OK"); | ||
})); | ||
}); | ||
}, "HTTP 302 Found POST Navigation"); | ||
</script> | ||
<body> | ||
<iframe id="frame" src="about:blank"></iframe> |