Accessing the query parameter of URL
throws an Unhashable Type error
#2079
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
EDIT: Sorry, looking into this a bit more I realized the below case would not happen because
starlette/starlette/datastructures.py
Line 59 in ada845c
I recently bumped FastAPI to 0.95 which also bumped starlette to 0.26.0 and I noticed something that may be an issue. Before the update we created a URL like this:
and calling the
include_query_params
function now throws a URL Unhashable type due to this change: https://github.com/encode/starlette/pull/1385/files.The issue is fixed by simply changing it to:
as it now returns a URL and not a string.
Looking at the init of URL
starlette/starlette/datastructures.py
Lines 57 to 61 in ada845c
I can see theres a condition for
elif components
where self._url becomes a URL type and not a string.I'm pretty sure in this situation the
Unhashable Type
error would also occur.Just wanted to make sure this is intended or not.
Beta Was this translation helpful? Give feedback.
All reactions