Coverage for docs_src/response_model/tutorial003_05.py: 100%
9 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
1from typing import Union 1abcde
3from fastapi import FastAPI, Response 1abcde
4from fastapi.responses import RedirectResponse 1abcde
6app = FastAPI() 1abcde
9@app.get("/portal", response_model=None) 1abcde
10async def get_portal(teleport: bool = False) -> Union[Response, dict]: 1abcde
11 if teleport: 1abcde
12 return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ") 1abcde
13 return {"message": "Here's your interdimensional portal."} 1abcde