pythonasyncioapiasyncfastapiframeworkjsonjson-schemaopenapiopenapi3pydanticpython-typespython3redocreststarletteswaggerswagger-uiuvicornweb
9 lines
222 B
9 lines
222 B
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"}
|
|
|