Drop prepare_request
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Tom Christie · committed by Tom Christie · parent 1970912 · Browse files · 3 files·+2 added−19 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+2 added−19 removed
- other:+2 added−19 removed
Provenance
- Commit
37da9ed- Tree
2575238- Author
Tom Christie <tom@tomchristie.com>- Committer
Tom Christie <tom@tomchristie.com>- Parent
1970912
3 files changed+2 added−19 removed
modified:httpcore/client.py-8 removed
295 unmodified lines296 params=params,297 headers=headers,298 cookies=self.merge_cookies(cookies),299 )300- self.prepare_request(request)300 response = await self.send(301 request,302 stream=stream,303 auth=auth,3 unmodified lines307 timeout=timeout,308 )309 return response310 312- def prepare_request(self, request: Request) -> None:313- request.prepare()314-311 def merge_cookies(312 self, cookies: CookieTypes = None313 ) -> typing.Optional[CookieTypes]:314 if cookies or self.cookies:229 unmodified lines544 params=params,545 headers=headers,546 cookies=self._client.merge_cookies(cookies),547 )552- self.prepare_request(request)548 response = self.send(549 request,550 stream=stream,551 auth=auth,208 unmodified lines760 cert=cert,761 timeout=timeout,762 )763 769- def prepare_request(self, request: Request) -> None:770- self._client.prepare_request(request)771-764 def send(765 self,766 request: Request,767 *,33 unmodified linesmodified:httpcore/interfaces.py-4 removed
42 unmodified lines43 cert: CertTypes = None,44 timeout: TimeoutTypes = None45 ) -> Response:46 request = Request(method, url, data=data, params=params, headers=headers)47- self.prepare_request(request)47 response = await self.send(48 request, stream=stream, verify=verify, cert=cert, timeout=timeout49 )50 return response51 53- def prepare_request(self, request: Request) -> None:54- request.prepare()55-52 async def send(53 self,54 request: Request,55 stream: bool = False,75 unmodified linesmodified:httpcore/models.py+2 added-7 removed
501 unmodified lines502 else:503 self.is_streaming = True504 self.content_aiter = data505 506+ self.prepare()507+508 async def read(self) -> bytes:509 """510 Read and return the response content.511 """8 unmodified lines520 elif self.content:521 yield self.content522 523 def prepare(self) -> None:522- """523- Adds in any default headers. When using the `Client`, this will524- end up being called into by the `prepare_request()` stage.525-526- You can omit this behavior by calling `Client.send()` with an527- explicitly built `Request` instance.528- """524 auto_headers = [] # type: typing.List[typing.Tuple[bytes, bytes]]525 526 has_host = "host" in self.headers527 has_content_length = (504 unmodified lines