File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
packages/smithy-http/tests/unit/aio Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 11# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22# SPDX-License-Identifier: Apache-2.0
33from copy import deepcopy
4+ from io import BytesIO
45
56import pytest
67
8+ from smithy_core import URI
9+ from smithy_http import Fields
10+ from smithy_http .aio import HTTPRequest
711from smithy_http .aio .crt import AWSCRTHTTPClient , BufferableByteStream
812
913
@@ -12,6 +16,22 @@ def test_deepcopy_client() -> None:
1216 deepcopy (client )
1317
1418
19+ async def test_client_marshal_request () -> None :
20+ client = AWSCRTHTTPClient ()
21+ request = HTTPRequest (
22+ method = "GET" ,
23+ destination = URI (
24+ host = "example.com" , path = "/path" , query = "key1=value1&key2=value2"
25+ ),
26+ body = BytesIO (),
27+ fields = Fields (),
28+ )
29+ crt_request = await client ._marshal_request (request ) # type: ignore
30+ assert crt_request .headers .get ("host" ) == "example.com" # type: ignore
31+ assert crt_request .method == "GET" # type: ignore
32+ assert crt_request .path == "/path?key1=value1&key2=value2" # type: ignore
33+
34+
1535def test_stream_write () -> None :
1636 stream = BufferableByteStream ()
1737 stream .write (b"foo" )
You can’t perform that action at this time.
0 commit comments