Add raw_path to scope in ASGITransport#1357
Merged
lovelydinosaur merged 2 commits intoencode:masterfrom Oct 9, 2020
simonw:master
Merged
Add raw_path to scope in ASGITransport#1357lovelydinosaur merged 2 commits intoencode:masterfrom simonw:master
lovelydinosaur merged 2 commits intoencode:masterfrom
simonw:master
Conversation
simonw
commented
Oct 9, 2020
tests/test_asgi.py
Outdated
|
|
||
| async def echo_raw_path(scope, receive, send): | ||
| status = 200 | ||
| output = json.dumps({"raw_path": repr(scope["raw_path"])}).encode("utf-8") |
Contributor
Author
There was a problem hiding this comment.
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.
Contributor
There was a problem hiding this comment.
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.
lovelydinosaur
approved these changes
Oct 9, 2020
Contributor
|
Fab, thanks! |
This was referenced Oct 9, 2020
This was referenced Mar 15, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1356