mirror of
https://github.com/fastapi/fastapi.git
synced 2026-04-13 11:33:45 -04:00
✨ 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:
committed by
GitHub
parent
c8eea09664
commit
5f7fe926ab
@@ -47,7 +47,6 @@ In short:
|
||||
!!! tip
|
||||
To know more about each status code and which code is for what, check the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status" target="_blank"><abbr title="Mozilla Developer Network">MDN</abbr> documentation about HTTP status codes</a>.
|
||||
|
||||
|
||||
## Shortcut to remember the names
|
||||
|
||||
Let's see the previous example again:
|
||||
@@ -69,3 +68,7 @@ You can use the convenience variables from `starlette.status`.
|
||||
They are just a convenience, they hold the same number, but that way you can use the editor's autocomplete to find them:
|
||||
|
||||
<img src="/img/tutorial/response-status-code/image02.png">
|
||||
|
||||
## Changing the default
|
||||
|
||||
Later, in a more advanced part of the tutorial/user guide, you will see how to <a href="https://fastapi.tiangolo.com/tutorial/response-change-status-code/" target="_blank">return a different status code than the default</a> you are declaring here.
|
||||
|
||||
Reference in New Issue
Block a user