Coverage for docs_src / response_directly / tutorial002_py310.py: 100%

6 statements  

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

1from fastapi import FastAPI, Response 1abc

2 

3app = FastAPI() 1abc

4 

5 

6@app.get("/legacy/") 1abc

7def get_legacy_data(): 1abc

8 data = """<?xml version="1.0"?> 1def

9 <shampoo> 

10 <Header> 

11 Apply shampoo here. 

12 </Header> 

13 <Body> 

14 You'll have to use soap here. 

15 </Body> 

16 </shampoo> 

17 """ 

18 return Response(content=data, media_type="application/xml") 1def