- Sort Score
- Result 10 results
- Languages All
Results 1 - 8 of 8 for ORJSONResponse (0.1 sec)
-
docs_src/custom_response/tutorial001b_py39.py
from fastapi import FastAPI from fastapi.responses import ORJSONResponse app = FastAPI() @app.get("/items/", response_class=ORJSONResponse) async def read_items():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 215 bytes - Viewed (0) -
tests/test_orjson_response_class.py
from fastapi import FastAPI from fastapi.responses import ORJSONResponse from fastapi.testclient import TestClient from sqlalchemy.sql.elements import quoted_name app = FastAPI(default_response_class=ORJSONResponse) @app.get("/orjson_non_str_keys") def get_orjson_non_str_keys(): key = quoted_name(value="msg", quote=False) return {key: "Hello World", 1: 1} client = TestClient(app) def test_orjson_non_str_keys():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Sep 02 10:17:31 UTC 2022 - 562 bytes - Viewed (0) -
docs_src/custom_response/tutorial010_py39.py
from fastapi import FastAPI from fastapi.responses import ORJSONResponse app = FastAPI(default_response_class=ORJSONResponse) @app.get("/items/") async def read_items():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 205 bytes - Viewed (0) -
fastapi/responses.py
""" def render(self, content: Any) -> bytes: assert ujson is not None, "ujson must be installed to use UJSONResponse" return ujson.dumps(content, ensure_ascii=False).encode("utf-8") class ORJSONResponse(JSONResponse): """ JSON response using the high-performance orjson library to serialize data to JSON. Read more about it in theRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Oct 18 12:36:40 UTC 2023 - 1.7K bytes - Viewed (0) -
docs/zh/docs/advanced/custom-response.md
/// note | 说明 如果你使用不带有任何媒体类型的响应类,FastAPI 认为你的响应没有任何内容,所以不会在生成的OpenAPI文档中记录响应格式。 /// ## 使用 `ORJSONResponse` 例如,如果你需要压榨性能,你可以安装并使用 <a href="https://github.com/ijl/orjson" class="external-link" target="_blank">`orjson`</a> 并将响应设置为 `ORJSONResponse`。 导入你想要使用的 `Response` 类(子类)然后在 *路径操作装饰器* 中声明它。 {* ../../docs_src/custom_response/tutorial001b.py hl[2,7] *} /// info | 提示
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 18 02:25:44 UTC 2024 - 7.5K bytes - Viewed (0) -
docs/en/docs/reference/responses.md
You can import them directly from `fastapi.responses`: ```python from fastapi.responses import ( FileResponse, HTMLResponse, JSONResponse, ORJSONResponse, PlainTextResponse, RedirectResponse, Response, StreamingResponse, UJSONResponse, ) ``` ## FastAPI Responses
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Thu Apr 18 19:53:19 UTC 2024 - 3.7K bytes - Viewed (0) -
tests/test_default_response_class.py
from fastapi.testclient import TestClient class ORJSONResponse(JSONResponse): media_type = "application/x-orjson" def render(self, content: Any) -> bytes: return orjson.dumps(content) class OverrideResponse(JSONResponse): media_type = "application/x-override" app = FastAPI(default_response_class=ORJSONResponse) router_a = APIRouter() router_a_a = APIRouter()Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sun Mar 01 20:49:20 UTC 2020 - 5.2K bytes - Viewed (0) -
pyproject.toml
# For Starlette's schema generation, would not be used with FastAPI "pyyaml >=5.3.1", # For UJSONResponse "ujson >=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0", # For ORJSONResponse "orjson >=3.2.1", # To validate email fields "email-validator >=2.0.0", # Uvicorn with uvloop "uvicorn[standard] >=0.12.0", # Settings management "pydantic-settings >=2.0.0",
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 12:54:56 UTC 2025 - 9.3K bytes - Viewed (0)