diff --git a/packages/smithy-http/src/smithy_http/aio/crt.py b/packages/smithy-http/src/smithy_http/aio/crt.py index 480b71fba..625477846 100644 --- a/packages/smithy-http/src/smithy_http/aio/crt.py +++ b/packages/smithy-http/src/smithy_http/aio/crt.py @@ -11,6 +11,7 @@ from threading import Lock from typing import TYPE_CHECKING, Any + if TYPE_CHECKING: # pyright doesn't like optional imports. This is reasonable because if we use these # in type hints then they'd result in runtime errors. @@ -292,11 +293,14 @@ async def _marshal_request( """Create :py:class:`awscrt.http.HttpRequest` from :py:class:`smithy_http.aio.HTTPRequest`""" headers_list = [] - if "Host" not in request.fields: + if "host" not in request.fields: request.fields.set_field( - Field(name="Host", values=[request.destination.host]) + Field(name="host", values=[request.destination.host]) ) + if "accept" not in request.fields: + request.fields.set_field(Field(name="accept", values=["*/*"])) + for fld in request.fields.entries.values(): # TODO: Use literal values for "header"/"trailer". if fld.kind.value != FieldPosition.HEADER.value: diff --git a/packages/smithy-http/tests/unit/aio/test_crt.py b/packages/smithy-http/tests/unit/aio/test_crt.py index 4694b6e3a..d766601e6 100644 --- a/packages/smithy-http/tests/unit/aio/test_crt.py +++ b/packages/smithy-http/tests/unit/aio/test_crt.py @@ -28,6 +28,7 @@ async def test_client_marshal_request() -> None: ) crt_request = await client._marshal_request(request) # type: ignore assert crt_request.headers.get("host") == "example.com" # type: ignore + assert crt_request.headers.get("accept") == "*/*" # type: ignore assert crt_request.method == "GET" # type: ignore assert crt_request.path == "/path?key1=value1&key2=value2" # type: ignore