fastapi-master/docs_src/response_headers/tutorial002.py

10 lines
222 B
Python
Raw Normal View History

2024-08-24 12:41:47 +08:00
from fastapi import FastAPI, Response
app = FastAPI()
@app.get("/headers-and-object/")
def get_headers(response: Response):
response.headers["X-Cat-Dog"] = "alone in the world"
return {"message": "Hello World"}