✨ Add support for Response parameters to set headers, cookies, and status codes (#294)

* ✨ Add support for declaring a Response parameter to set headers and cookies

* ✅ Add source for docs and tests

* 📝 Add docs for setting headers, cookies and status code

* 📝 Add attribution to Hug for inspiring response parameters
This commit is contained in:
Sebastián Ramírez authored and GitHub committed 2019-06-06 14:29:40 +04:00
1 parent c8eea09664
commit 5f7fe926ab
17 files changed
+229 -13

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
from fastapi import FastAPI
from starlette.responses import 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"}