Skip to content

Commit

Permalink
fix TestClient to preserve raw URI
Browse files Browse the repository at this point in the history
  • Loading branch information
liborjelinek committed Jul 14, 2023
1 parent 7191be4 commit af2c9d7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions falcon/testing/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,8 @@ def create_environ(
body = io.BytesIO(body.encode() if isinstance(body, str) else body)

# NOTE(kgriffs): wsgiref, gunicorn, and uWSGI all unescape
# the paths before setting PATH_INFO
# the paths before setting PATH_INFO but preserve raw original
raw_path = path
path = uri.decode(path, unquote_plus=False)

# NOTE(kgriffs): The decoded path may contain UTF-8 characters.
Expand Down Expand Up @@ -1194,7 +1195,7 @@ def create_environ(
'PATH_INFO': path,
'QUERY_STRING': query_string,
'REMOTE_PORT': '65133',
'RAW_URI': '/',
'RAW_URI': raw_path,
'SERVER_NAME': host,
'SERVER_PORT': port,
'wsgi.version': (1, 0),
Expand Down

0 comments on commit af2c9d7

Please sign in to comment.