Files
fastapi/docs/src/response_headers/tutorial001.py
2019-04-26 15:13:59 +04:00

12 lines
311 B
Python

from fastapi import FastAPI
from starlette.responses import JSONResponse
app = FastAPI()
@app.get("/headers/")
def get_headers():
content = {"message": "Hello World"}
headers = {"X-Cat-Dog": "alone in the world", "Content-Language": "en-US"}
return JSONResponse(content=content, headers=headers)