mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-12-23 02:52:34 +03:00
Fix redirection not followed with 'location' header.
This commit is contained in:
parent
0d6b1cb7a0
commit
810089bd2a
@ -68,6 +68,7 @@ def test(hurl_file):
|
||||
env[name] = value
|
||||
|
||||
cmd = ["hurl", hurl_file] + options
|
||||
# cmd = ["cargo", "run", "--bin", "hurl", "--", hurl_file] + options
|
||||
print(" ".join(cmd))
|
||||
result = subprocess.run(
|
||||
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env
|
||||
|
@ -1,5 +1,5 @@
|
||||
from app import app
|
||||
from flask import redirect
|
||||
from flask import redirect, Response
|
||||
|
||||
|
||||
@app.route("/follow-redirect")
|
||||
@ -9,7 +9,17 @@ def follow_redirect():
|
||||
|
||||
@app.route("/following-redirect")
|
||||
def following_redirect():
|
||||
return redirect("http://localhost:8000/followed-redirect")
|
||||
# For this redirection, we construct the response instead of using
|
||||
# Flask `redirect` function to make a redirection with a 'location' header (instead of 'Location').
|
||||
response = Response(
|
||||
response="<!DOCTYPE html>\n"
|
||||
"<title>Redirecting...</title>\n"
|
||||
"<h1>Redirecting...</h1>\n",
|
||||
status=302,
|
||||
mimetype="text/html",
|
||||
)
|
||||
response.headers["location"] = "http://localhost:8000/followed-redirect"
|
||||
return response
|
||||
|
||||
|
||||
@app.route("/followed-redirect")
|
||||
|
@ -151,7 +151,7 @@ pub fn get_header_values(headers: &[Header], expected_name: &str) -> Vec<String>
|
||||
headers
|
||||
.iter()
|
||||
.filter_map(|Header { name, value }| {
|
||||
if name == expected_name {
|
||||
if name.to_lowercase() == expected_name.to_lowercase() {
|
||||
Some(value.to_string())
|
||||
} else {
|
||||
None
|
||||
|
Loading…
Reference in New Issue
Block a user