Browse Source
📝 Update includes for `docs/en/docs/advanced/response-directly.md` (#12803)
pull/12808/head
Baldeep Singh Handa
5 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
2 additions and
6 deletions
-
docs/en/docs/advanced/response-directly.md
|
|
@ -34,9 +34,7 @@ For example, you cannot put a Pydantic model in a `JSONResponse` without first c |
|
|
|
|
|
|
|
For those cases, you can use the `jsonable_encoder` to convert your data before passing it to a response: |
|
|
|
|
|
|
|
```Python hl_lines="6-7 21-22" |
|
|
|
{!../../docs_src/response_directly/tutorial001.py!} |
|
|
|
``` |
|
|
|
{* ../../docs_src/response_directly/tutorial001.py hl[6:7,21:22] *} |
|
|
|
|
|
|
|
/// note | "Technical Details" |
|
|
|
|
|
|
@ -56,9 +54,7 @@ Let's say that you want to return an <a href="https://en.wikipedia.org/wiki/XML" |
|
|
|
|
|
|
|
You could put your XML content in a string, put that in a `Response`, and return it: |
|
|
|
|
|
|
|
```Python hl_lines="1 18" |
|
|
|
{!../../docs_src/response_directly/tutorial002.py!} |
|
|
|
``` |
|
|
|
{* ../../docs_src/response_directly/tutorial002.py hl[1,18] *} |
|
|
|
|
|
|
|
## Notes |
|
|
|
|
|
|
|