mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-23 22:29:34 -05:00
Co-authored-by: Yurii Motov <yurii.motov.monte@gmail.com> Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
12 lines
309 B
Python
12 lines
309 B
Python
from fastapi import FastAPI
|
|
from fastapi.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)
|