Skip to content

Commit 3a2dff9

Browse files
Fix path and query serialization
This updates query serialization to no longer add an extraneous `&` as well as ensures that the path starts with `/`.
1 parent 16f4b32 commit 3a2dff9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/smithy-http/src/smithy_http/aio/protocols.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ def set_service_endpoint(
4646
if uri.path is not None and previous.path is not None:
4747
path = os.path.join(uri.path, previous.path.lstrip("/"))
4848

49+
if path is not None and not path.startswith("/"):
50+
path = "/" + path
51+
4952
query = previous.query or uri.query
50-
if uri.query is not None and previous.query is not None:
53+
if uri.query and previous.query:
5154
query = f"{uri.query}&{previous.query}"
5255

5356
request.destination = _URI(

0 commit comments

Comments
 (0)