Skip to content

Commit 64cd6b4

Browse files
committed
Set the host header if not set in CRT HTTP client.
1 parent febae70 commit 64cd6b4

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ async def _marshal_request(
293293
:py:class:`smithy_http.aio.HTTPRequest`"""
294294
headers_list = []
295295
if "Host" not in request.fields:
296-
request.fields.set_field(Field(name="Host", values=[request.destination.host]))
296+
request.fields.set_field(
297+
Field(name="Host", values=[request.destination.host])
298+
)
297299

298300
for fld in request.fields.entries.values():
299301
# TODO: Use literal values for "header"/"trailer".

packages/smithy-http/src/smithy_http/interfaces/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ def __len__(self) -> int:
9898
"""Get total number of Field entries."""
9999
...
100100

101+
def __contains__(self, key: str) -> bool:
102+
"""Allows in/not in checks on Field entries."""
103+
...
104+
101105
def get_by_type(self, kind: FieldPosition) -> list[Field]:
102106
"""Helper function for retrieving specific types of fields.
103107

0 commit comments

Comments
 (0)