mirror of
https://github.com/fastapi/fastapi.git
synced 2026-10-24 10:49:21 -04:00
✨ Allow setting the response_class to RedirectResponse and returning the URL from the function (#3457)
This commit is contained in:
1 parent
ea8d7f689e
commit
dc5a966548
13 files changed
+226
-29
No files matched your search
@@ -0,0 +1,9 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.responses import RedirectResponse
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/pydantic", response_class=RedirectResponse, status_code=302)
|
||||
async def redirect_pydantic():
|
||||
return "https://pydantic-docs.helpmanual.io/"
|
||||
Reference in new issue
Block a user