File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1111from litestar .openapi .plugins import ScalarRenderPlugin
1212from litestar .openapi .spec import Contact , ExternalDocumentation , License , Server
1313from litestar .response import Redirect
14+ from litestar .response .base import ASGIResponse
1415
1516# Load .env from oauth/ or repo root if present
1617_env_file = Path (__file__ ).parent / ".env"
@@ -53,8 +54,8 @@ async def auth() -> Redirect:
5354 return Redirect (f"{ AUTHORIZE_URL } ?client_id={ CLIENT_ID } &scope=repo,user" )
5455
5556
56- @get ("/callback" )
57- async def callback (code : str ) -> str :
57+ @get ("/callback" , media_type = "text/html" )
58+ async def callback (code : str ) -> ASGIResponse :
5859 async with httpx .AsyncClient () as client :
5960 resp = await client .post (
6061 TOKEN_URL ,
@@ -63,7 +64,7 @@ async def callback(code: str) -> str:
6364 )
6465 resp .raise_for_status ()
6566 token = resp .json ()["access_token" ]
66- return CALLBACK_HTML % token
67+ return ASGIResponse ( body = ( CALLBACK_HTML % token ). encode (), media_type = "text/html" )
6768
6869
6970app = Litestar (
You can’t perform that action at this time.
0 commit comments