diff --git a/integration/tests_ok/very_verbose.curl b/integration/tests_ok/very_verbose.curl new file mode 100644 index 000000000..3396d3651 --- /dev/null +++ b/integration/tests_ok/very_verbose.curl @@ -0,0 +1,5 @@ +curl 'http://localhost:8000/very-verbose/redirect' -L +curl 'http://localhost:8000/very-verbose/encoding/latin1' -L +curl 'http://localhost:8000/very-verbose/compressed/brotli' -X POST -H 'Accept-Encoding: brotli' -L +curl 'http://localhost:8000/very-verbose/cat' -L +curl 'http://localhost:8000/very-verbose/done' -L diff --git a/integration/tests_ok/very_verbose.err.pattern b/integration/tests_ok/very_verbose.err.pattern new file mode 100644 index 000000000..4c114d4c0 --- /dev/null +++ b/integration/tests_ok/very_verbose.err.pattern @@ -0,0 +1,158 @@ +* Options: +* fail fast: true +* insecure: false +* follow redirect: true +* max redirect: 50 +* ------------------------------------------------------------------------------ +* Executing entry 1 +* +* Cookie store: +* +* Request: +* GET http://localhost:8000/very-verbose/redirect +* +* Request can be run with the following curl command: +* curl 'http://localhost:8000/very-verbose/redirect' -L +* +> GET /very-verbose/redirect HTTP/1.1 +> Host: localhost:8000 +> Accept: */* +> User-Agent: hurl/~~~-snapshot +> +< HTTP/1.0 301 MOVED PERMANENTLY +< Content-Type: text/html; charset=utf-8 +< Content-Length: 205 +< Location: http://localhost:8000/very-verbose/redirected +< Server: Flask Server +< Date: ~~~, ~~ ~~~ ~~~~ ~~:~~:~~ GMT +< +* Response: +* +* +* +* 301 Moved +* +* +*

301 Moved

+* The document has moved +* here. +* +* +> GET /very-verbose/redirected HTTP/1.1 +> Host: localhost:8000 +> Accept: */* +> User-Agent: hurl/~~~-snapshot +> +< HTTP/1.0 200 OK +< Content-Type: text/html; charset=utf-8 +< Content-Length: 11 +< Server: Flask Server +< Date: ~~~, ~~ ~~~ ~~~~ ~~:~~:~~ GMT +< +* Response: +* Redirected. +* +* ------------------------------------------------------------------------------ +* Executing entry 2 +* +* Cookie store: +* +* Request: +* GET http://localhost:8000/very-verbose/encoding/latin1 +* +* Request can be run with the following curl command: +* curl 'http://localhost:8000/very-verbose/encoding/latin1' -L +* +> GET /very-verbose/encoding/latin1 HTTP/1.1 +> Host: localhost:8000 +> Accept: */* +> User-Agent: hurl/~~~-snapshot +> +< HTTP/1.0 200 OK +< Content-Type: text/html; charset=ISO-8859-1 +< Content-Length: 4 +< Server: Flask Server +< Date: ~~~, ~~ ~~~ ~~~~ ~~:~~:~~ GMT +< +* Response: +* café +* +* ------------------------------------------------------------------------------ +* Executing entry 3 +* +* Cookie store: +* +* Request: +* POST http://localhost:8000/very-verbose/compressed/brotli +* Accept-Encoding: brotli +* +* Request can be run with the following curl command: +* curl 'http://localhost:8000/very-verbose/compressed/brotli' -X POST -H 'Accept-Encoding: brotli' -L +* +> POST /very-verbose/compressed/brotli HTTP/1.1 +> Host: localhost:8000 +> Accept: */* +> Accept-Encoding: brotli +> User-Agent: hurl/1.7.0-snapshot +> +< HTTP/1.0 200 OK +< Content-Type: text/html; charset=utf-8 +< Content-Length: 17 +< Content-Encoding: br +< Server: Flask Server +< Date: ~~~, ~~ ~~~ ~~~~ ~~:~~:~~ GMT +< +* Response: +* Hello World! +* +* ------------------------------------------------------------------------------ +* Executing entry 4 +* +* Cookie store: +* +* Request: +* GET http://localhost:8000/very-verbose/cat +* +* Request can be run with the following curl command: +* curl 'http://localhost:8000/very-verbose/cat' -L +* +> GET /very-verbose/cat HTTP/1.1 +> Host: localhost:8000 +> Accept: */* +> User-Agent: hurl/~~~-snapshot +> +< HTTP/1.0 200 OK +< Content-Type: image/jpeg +< Content-Length: 25992 +< Server: Flask Server +< Date: ~~~, ~~ ~~~ ~~~~ ~~:~~:~~ GMT +< +* Response: +* Bytes +* +* ------------------------------------------------------------------------------ +* Executing entry 5 +* +* Cookie store: +* +* Request: +* GET http://localhost:8000/very-verbose/done +* +* Request can be run with the following curl command: +* curl 'http://localhost:8000/very-verbose/done' -L +* +> GET /very-verbose/done HTTP/1.1 +> Host: localhost:8000 +> x-foo: bar +> Accept: */* +> User-Agent: hurl/~~~-snapshot +> +< HTTP/1.0 200 OK +< Content-Type: text/html; charset=utf-8 +< Content-Length: 4 +< Server: Flask Server +< Date: ~~~, ~~ ~~~ ~~~~ ~~:~~:~~ GMT +< +* Response: +* Done +* diff --git a/integration/tests_ok/very_verbose.exit b/integration/tests_ok/very_verbose.exit new file mode 100644 index 000000000..c22708346 --- /dev/null +++ b/integration/tests_ok/very_verbose.exit @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/integration/tests_ok/very_verbose.html b/integration/tests_ok/very_verbose.html new file mode 100644 index 000000000..a45847cbe --- /dev/null +++ b/integration/tests_ok/very_verbose.html @@ -0,0 +1,17 @@ +
GET http://localhost:8000/very-verbose/redirect
+HTTP/* 200
+
+GET http://localhost:8000/very-verbose/encoding/latin1
+HTTP/* 200
+
+POST http://localhost:8000/very-verbose/compressed/brotli
+Accept-Encoding: brotli
+HTTP/* 200
+
+GET http://localhost:8000/very-verbose/cat
+HTTP/* 200
+
+GET http://localhost:8000/very-verbose/done
+x-foo: bar
+HTTP/* 200
+
\ No newline at end of file diff --git a/integration/tests_ok/very_verbose.hurl b/integration/tests_ok/very_verbose.hurl new file mode 100644 index 000000000..a12fdc6df --- /dev/null +++ b/integration/tests_ok/very_verbose.hurl @@ -0,0 +1,16 @@ +GET http://localhost:8000/very-verbose/redirect +HTTP/* 200 + +GET http://localhost:8000/very-verbose/encoding/latin1 +HTTP/* 200 + +POST http://localhost:8000/very-verbose/compressed/brotli +Accept-Encoding: brotli +HTTP/* 200 + +GET http://localhost:8000/very-verbose/cat +HTTP/* 200 + +GET http://localhost:8000/very-verbose/done +x-foo: bar +HTTP/* 200 diff --git a/integration/tests_ok/very_verbose.json b/integration/tests_ok/very_verbose.json new file mode 100644 index 000000000..9774e87a5 --- /dev/null +++ b/integration/tests_ok/very_verbose.json @@ -0,0 +1 @@ +{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/very-verbose/redirect"},"response":{"status":200}},{"request":{"method":"GET","url":"http://localhost:8000/very-verbose/encoding/latin1"},"response":{"status":200}},{"request":{"method":"POST","url":"http://localhost:8000/very-verbose/compressed/brotli","headers":[{"name":"Accept-Encoding","value":"brotli"}]},"response":{"status":200}},{"request":{"method":"GET","url":"http://localhost:8000/very-verbose/cat"},"response":{"status":200}},{"request":{"method":"GET","url":"http://localhost:8000/very-verbose/done","headers":[{"name":"x-foo","value":"bar"}]},"response":{"status":200}}]} \ No newline at end of file diff --git a/integration/tests_ok/very_verbose.options b/integration/tests_ok/very_verbose.options new file mode 100644 index 000000000..18a41073e --- /dev/null +++ b/integration/tests_ok/very_verbose.options @@ -0,0 +1,2 @@ +--very-verbose +--location \ No newline at end of file diff --git a/integration/tests_ok/very_verbose.py b/integration/tests_ok/very_verbose.py new file mode 100644 index 000000000..93041b55c --- /dev/null +++ b/integration/tests_ok/very_verbose.py @@ -0,0 +1,68 @@ +from io import BytesIO + +from app import app +from flask import Response, make_response, request + + +def redirect(location, status=301): + body = f""" + + + 301 Moved + + +

{status} Moved

+The document has moved +here. + +""" + response = Response(response=body, status=status, mimetype="text/html") + response.headers["Location"] = location + return response + + +@app.route("/very-verbose/redirect") +def very_verbose_redirect(): + return redirect(location="/very-verbose/redirected") + + +@app.route("/very-verbose/redirected") +def very_verbose_redirected(): + return "Redirected." + + +@app.route("/very-verbose/encoding/latin1") +def very_verbose_encoding_latin1(): + result = BytesIO() + result.write(b"\x63\x61\x66\xe9") # café in ISO-8859-1 + data = result.getvalue() + resp = make_response(data) + resp.content_type = "text/html; charset=ISO-8859-1" + return resp + + +@app.route("/very-verbose/compressed/brotli", methods=["GET", "POST"]) +def very_verbose_compressed_brotli(): + assert "br" in request.headers["Accept-Encoding"] + result = BytesIO() + result.write( + b"\x21\x2c\x00\x04\x48\x65\x6c\x6c\x6f\x20\x57\x6f\x72\x6c\x64\x21\x03" + ) + data = result.getvalue() + resp = make_response(data) + resp.headers["Content-Encoding"] = "br" + return resp + + +@app.route("/very-verbose/cat") +def very_verbose_image(): + with open("tests_ok/cat.jpg.br", "rb") as f: + data = f.read() + resp = make_response(data) + resp.headers["Content-Type"] = "image/jpeg" + return resp + + +@app.route("/very-verbose/done") +def very_verbose_done(): + return "Done"