- Sort Score
- Result 10 results
- Languages All
Results 1 - 4 of 4 for CustomORJSONResponse (0.14 sec)
-
docs/em/docs/advanced/custom-response.md
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 9.7K bytes - Viewed (0) -
docs/de/docs/advanced/custom-response.md
Sie möchten etwa, dass Ihre Response eingerücktes und formatiertes JSON zurückgibt. Dafür möchten Sie die orjson-Option `orjson.OPT_INDENT_2` verwenden. Sie könnten eine `CustomORJSONResponse` erstellen. Das Wichtigste, was Sie tun müssen, ist, eine `Response.render(content)`-Methode zu erstellen, die den Inhalt als `bytes` zurückgibt: ```Python hl_lines="9-14 17"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 13.5K bytes - Viewed (0) -
docs/pt/docs/advanced/custom-response.md
Vamos supor também que você queira retornar um JSON indentado e formatado, então você quer utilizar a opção `orjson.OPT_INDENT_2` do orjson. Você poderia criar uma classe `CustomORJSONResponse`. A principal coisa a ser feita é sobrecarregar o método render da classe Response, `Response.render(content)`, que retorna o conteúdo em bytes, para retornar o conteúdo que você deseja: ```Python hl_lines="9-14 17"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Oct 29 11:47:10 UTC 2024 - 13.5K bytes - Viewed (0) -
docs/en/docs/advanced/custom-response.md
Let's say you want it to return indented and formatted JSON, so you want to use the orjson option `orjson.OPT_INDENT_2`. You could create a `CustomORJSONResponse`. The main thing you have to do is create a `Response.render(content)` method that returns the content as `bytes`: ```Python hl_lines="9-14 17" {!../../docs_src/custom_response/tutorial009c.py!} ```
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 12K bytes - Viewed (0)