Files
fastapi__fastapi/docs_src/response_directly/tutorial002.py
T

19 lines
354 B
Python
Raw Normal View History

from fastapi import FastAPI, Response
app = FastAPI()
@app.get("/legacy/")
def get_legacy_data():
2019-11-27 21:06:50 +01:00
data = """<?xml version="1.0"?>
<shampoo>
<Header>
Apply shampoo here.
2019-11-27 21:06:50 +01:00
</Header>
<Body>
You'll have to use soap here.
</Body>
</shampoo>
"""
return Response(content=data, media_type="application/xml")