Skip to content

Commit a14d455

Browse files
committed
Rename location.search to location.query_string
1 parent 278790d commit a14d455

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/reactpy/backend/middleware.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,17 @@ async def run_dispatcher(
163163

164164
# TODO: Get HTTP URL from `http_pathname` and `http_query_string`
165165
parsed_url = urllib.parse.urlparse(scope["path"])
166+
pathname = parsed_url.path
167+
query_string = f"?{parsed_url.query}" if parsed_url.query else ""
166168

167169
await serve_layout(
168170
Layout( # type: ignore
169171
ConnectionContext(
170172
component(),
171173
value=Connection(
172174
scope=scope,
173-
# TODO: Rename `search` to `query_string`
174175
location=Location(
175-
parsed_url.path,
176-
f"?{parsed_url.query}" if parsed_url.query else "",
176+
pathname=pathname, query_string=query_string
177177
),
178178
carrier={
179179
"scope": scope,

src/reactpy/backend/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ class Location:
3535
pathname: str
3636
"""the path of the URL for the location"""
3737

38-
search: str
39-
"""A search or query string - a '?' followed by the parameters of the URL.
38+
query_string: str
39+
"""HTTP query string - a '?' followed by the parameters of the URL.
4040
4141
If there are no search parameters this should be an empty string
4242
"""

tests/test_backend/test_all.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def ShowRoute():
124124
Location("/another/something/file.txt", "?key=value"),
125125
Location("/another/something/file.txt", "?key1=value1&key2=value2"),
126126
]:
127-
await display.goto(loc.pathname + loc.search)
127+
await display.goto(loc.pathname + loc.query_string)
128128
await poll_location.until_equals(loc)
129129

130130

0 commit comments

Comments
 (0)