Skip to content

Commit 62f41cc

Browse files
authored
fix(client): httpx oauth1 binary form data (#779)
build Content-Length header with correct length
1 parent 53ffa6a commit 62f41cc

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎authlib/integrations/httpx_client/oauth1_client.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def auth_flow(self, request: Request) -> typing.Generator[Request, Response, Non
2525
url, headers, body = self.prepare(
2626
request.method, str(request.url), request.headers, request.content
2727
)
28-
headers["Content-Length"] = str(len(body))
28+
headers["Content-Length"] = str(len(request.content))
2929
yield build_request(
3030
url=url, headers=headers, body=body, initial_request=request
3131
)

‎authlib/integrations/httpx_client/utils.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def extract_client_kwargs(kwargs):
3434
def build_request(url, headers, body, initial_request: Request) -> Request:
3535
"""Make sure that all the data from initial request is passed to the updated object."""
3636
updated_request = Request(
37-
method=initial_request.method, url=url, headers=headers, content=body
37+
method=initial_request.method, url=url, headers=headers, content=body, stream=initial_request.stream
3838
)
3939

4040
if hasattr(initial_request, "extensions"):

0 commit comments

Comments
 (0)