Coverage for docs_src/response_model/tutorial003_05_py310.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-08-08 03:53 +0000

1from fastapi import FastAPI, Response 1abc

2from fastapi.responses import RedirectResponse 1abc

3 

4app = FastAPI() 1abc

5 

6 

7@app.get("/portal", response_model=None) 1abc

8async def get_portal(teleport: bool = False) -> Response | dict: 1abc

9 if teleport: 1abc

10 return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ") 1abc

11 return {"message": "Here's your interdimensional portal."} 1abc