diff options
author | Andrei Zeliankou <zelenkov@nginx.com> | 2024-04-30 14:55:06 +0800 |
---|---|---|
committer | Zhidao HONG <z.hong@f5.com> | 2024-05-09 09:51:34 +0800 |
commit | 00009765a825346127c411250d46ed5647c9a823 (patch) | |
tree | 347823f1a25ca0724c103ad5b583e852904aa4a7 /test | |
parent | eed21785b761f885d8e74fbbb21c05cc487a7ad0 (diff) | |
download | unit-00009765a825346127c411250d46ed5647c9a823.tar.gz unit-00009765a825346127c411250d46ed5647c9a823.tar.bz2 |
tests: REQUEST_URI variable test with rewrite
Diffstat (limited to 'test')
-rw-r--r-- | test/test_python_application.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/test_python_application.py b/test/test_python_application.py index 466a59a2..c4803153 100644 --- a/test/test_python_application.py +++ b/test/test_python_application.py @@ -10,6 +10,7 @@ import pytest from packaging import version from unit.applications.lang.python import ApplicationPython +from unit.option import option prerequisites = {'modules': {'python': 'all'}} @@ -64,6 +65,45 @@ custom-header: BLAH }, 'headers' assert resp['body'] == body, 'body' + # REQUEST_URI unchanged + + path = f'{option.test_dir}/python/variables' + assert 'success' in client.conf( + { + "listeners": {"*:8080": {"pass": "routes"}}, + "routes": [ + { + "action": { + "rewrite": "/foo", + "pass": "applications/variables", + } + } + ], + "applications": { + "variables": { + "type": client.get_application_type(), + "processes": {'spare': 0}, + "path": path, + "working_directory": path, + "module": "wsgi", + } + }, + } + ) + + resp = client.http( + f"""POST /bar HTTP/1.1 +Host: localhost +Content-Length: 1 +Custom-Header: blah +Content-Type: text/html +Connection: close + +a""".encode(), + raw=True, + ) + assert resp['headers']['Request-Uri'] == '/bar', 'REQUEST_URI unchanged' + def test_python_application_query_string(): client.load('query_string') |