✨ Add HTTPException with custom headers (#35)

* 📝 Update Release Notes with issue templates

* ✨ Add HTTPException with support for headers

Including docs and tests

* 📝 Update Security docs to use new HTTPException
This commit is contained in:
Sebastián Ramírez authored and GitHub committed 2019-02-16 17:01:29 +04:00
1 parent 7edbd9345b
commit 8772e2f2ee
16 files changed
+452 -14

No files matched your search

+5 -5
View File
@@ -78,9 +78,9 @@ Now, get the user data from the (fake) database, using the `username` from the f
If there is no such user, we return an error saying "incorrect username or password".
For the error, we use the exception `HTTPException` provided by Starlette directly:
For the error, we use the exception `HTTPException`:
```Python hl_lines="4 74 75 76"
```Python hl_lines="1 73 74 75"
{!./src/security/tutorial003.py!}
```
@@ -108,7 +108,7 @@ If your database is stolen, the thief won't have your users' plaintext passwords
So, the thief won't be able to try to use that password in another system (as many users use the same password everywhere, this would be dangerous).
```Python hl_lines="77 78 79 80"
```Python hl_lines="76 77 78 79"
{!./src/security/tutorial003.py!}
```
@@ -146,7 +146,7 @@ For this simple example, we are going to just be completely insecure and return
But for now, let's focus on the specific details we need.
```Python hl_lines="82"
```Python hl_lines="81"
{!./src/security/tutorial003.py!}
```
@@ -162,7 +162,7 @@ Both of these dependencies will just return an HTTP error if the user doesn't ex
So, in our endpoint, we will only get a user if the user exists, was correctly authenticated, and is active:
```Python hl_lines="57 58 59 60 61 62 63 66 67 68 69 86"
```Python hl_lines="56 57 58 59 60 61 62 65 66 67 68 85"
{!./src/security/tutorial003.py!}
```