mirror of
https://github.com/fastapi/fastapi.git
synced 2026-01-01 18:47:55 -05:00
12 lines
311 B
Python
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)
|