@@ -101,7 +101,7 @@ async def handle(self, request: WasiRequest) -> WasiResponse:
101101 simple_response .headers ['content-length' ] = str (content_length )
102102
103103 tx , rx = wit .byte_stream ()
104- componentize_py_async_support .spawn (copy (simple_response .body , tx ))
104+ componentize_py_async_support .spawn (_copy (simple_response .body , tx ))
105105 response = WasiResponse .new (Fields .from_list (list (map (
106106 lambda pair : (pair [0 ], bytes (pair [1 ], "utf-8" )),
107107 simple_response .headers .items ()
@@ -159,7 +159,7 @@ async def send(request: Request) -> Response:
159159 content_length = len (request .body ) if request .body is not None else 0
160160 # Make a copy rather than mutate in place, since the caller might not
161161 # expect us to mutate it:
162- headers_dict = headers_dict . copy ( )
162+ headers_dict = dict ( headers_dict )
163163 headers_dict ['content-length' ] = str (content_length )
164164
165165 headers = list (map (
@@ -168,12 +168,12 @@ async def send(request: Request) -> Response:
168168 ))
169169
170170 tx , rx = wit .byte_stream ()
171- componentize_py_async_support .spawn (copy (request .body , tx ))
171+ componentize_py_async_support .spawn (_copy (request .body , tx ))
172172 outgoing_request = WasiRequest .new (Fields .from_list (headers ), rx , _trailers_future (), None )[0 ]
173173 outgoing_request .set_method (method )
174174 outgoing_request .set_scheme (scheme )
175175 if url_parsed .netloc == '' :
176- if scheme == "http" :
176+ if isinstance ( scheme , Scheme_Http ) :
177177 authority = ":80"
178178 else :
179179 authority = ":443"
@@ -228,7 +228,7 @@ def strip_forbidden_headers(headers:MutableMapping[str, str]) -> MutableMapping[
228228 pass
229229 return headers
230230
231- async def copy (bytes :bytes , tx :ByteStreamWriter ):
231+ async def _copy (bytes : bytes | None , tx : ByteStreamWriter ) -> None :
232232 with tx :
233233 if bytes is not None :
234234 await tx .write_all (bytes )
0 commit comments