Coverage for docs_src / behind_a_proxy / tutorial004_py310.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-02-12 18:15 +0000

1from fastapi import FastAPI, Request 1abcd

2 

3app = FastAPI( 1abcd

4 servers=[ 

5 {"url": "https://stag.example.com", "description": "Staging environment"}, 

6 {"url": "https://prod.example.com", "description": "Production environment"}, 

7 ], 

8 root_path="/api/v1", 

9 root_path_in_servers=False, 

10) 

11 

12 

13@app.get("/app") 1abcd

14def read_main(request: Request): 1abcd

15 return {"message": "Hello World", "root_path": request.scope.get("root_path")} 1efg