-
-
Notifications
You must be signed in to change notification settings - Fork 857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add raw_path to scope in ASGITransport #1357
Conversation
tests/test_asgi.py
Outdated
@@ -23,6 +23,15 @@ async def echo_path(scope, receive, send): | |||
await send({"type": "http.response.body", "body": output}) | |||
|
|||
|
|||
async def echo_raw_path(scope, receive, send): | |||
status = 200 | |||
output = json.dumps({"raw_path": repr(scope["raw_path"])}).encode("utf-8") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using repr(scope["raw_path"])
here as an easy way to confirm that the value is indeed a Python bytestring - it ends up being returned as "b'/user%40example.org'"
in the JSON.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup that make sense.
I guess it might look a bit confusing to future readers, so we could either:
- Comment it.
- Switch it around to
{"raw_path": scope["raw_path"].decode("ascii")}
I'd marginally prefer (2), since it's actually perfectly sufficient here, but I'm okay enough with either.
Fab, thanks! |
Closes #1356