Switched JSON serialization to orjson for faster encoding and decoding.
CI / Formatting (push) Failing after 4s
CI / Linting (push) Successful in 4s
CI / Tests (Python 3.12) (push) Successful in 12s
CI / Tests (Python 3.13) (push) Successful in 12s
CI / Tests (Python 3.14) (push) Successful in 10s
CI / Type Checking (push) Successful in 9s
CI / Spelling (push) Successful in 5s
Audit / Dependencies (push) Successful in 7s
CI / Formatting (push) Failing after 4s
CI / Linting (push) Successful in 4s
CI / Tests (Python 3.12) (push) Successful in 12s
CI / Tests (Python 3.13) (push) Successful in 12s
CI / Tests (Python 3.14) (push) Successful in 10s
CI / Type Checking (push) Successful in 9s
CI / Spelling (push) Successful in 5s
Audit / Dependencies (push) Successful in 7s
This commit is contained in:
@@ -26,6 +26,7 @@ from collections import defaultdict
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, Any, cast, overload
|
||||
|
||||
import orjson
|
||||
from aiohttp import web
|
||||
from aiohttp.web import DynamicResource
|
||||
|
||||
@@ -608,7 +609,10 @@ class RouteDispatcher:
|
||||
if isinstance(result, web.StreamResponse):
|
||||
return result
|
||||
if isinstance(result, dict):
|
||||
return web.json_response(result)
|
||||
return web.Response(
|
||||
body=orjson.dumps(result),
|
||||
content_type="application/json",
|
||||
)
|
||||
# pragma: no branch — defensive against untyped handlers
|
||||
mod_logger.error( # type: ignore[unreachable]
|
||||
f"Route handler '{route_info.full_path}' returned "
|
||||
|
||||
Reference in New Issue
Block a user