Skip to content

Commit 6a515cf

Browse files
committed
Give option to provide httpx_client_args for testing purposes
1 parent a328b93 commit 6a515cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/fastapi_oauth2/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ async def login_redirect(self, request: Request) -> RedirectResponse:
8787
redirect_uri=redirect_uri,
8888
)), 303)
8989

90-
async def token_redirect(self, request: Request) -> RedirectResponse:
90+
async def token_redirect(self, request: Request, **httpx_client_args) -> RedirectResponse:
9191
if not request.query_params.get("code"):
9292
raise OAuth2LoginError(400, "'code' parameter was not found in callback request")
9393
if not request.query_params.get("state"):
@@ -109,7 +109,7 @@ async def token_redirect(self, request: Request) -> RedirectResponse:
109109
"Content-Type": "application/x-www-form-urlencoded",
110110
})
111111
auth = httpx.BasicAuth(self.client_id, self.client_secret)
112-
async with httpx.AsyncClient() as session:
112+
async with httpx.AsyncClient(**httpx_client_args) as session:
113113
response = await session.post(token_url, headers=headers, content=content, auth=auth)
114114
try:
115115
self._oauth_client.parse_request_body_response(json.dumps(response.json()))

0 commit comments

Comments
 (0)