Merge branch 'feature/python-tests-t' of https://github.com/fastapi/fastapi into feature/python-tests-t

This commit is contained in:
svlandeg 2025-10-22 15:04:48 +02:00
commit 281641a957
2 changed files with 2 additions and 1 deletions

View File

@ -10,6 +10,7 @@ class CustomORJSONResponse(Response):
def render(self, content: Any) -> bytes: def render(self, content: Any) -> bytes:
import orjson import orjson
assert orjson is not None, "orjson must be installed" assert orjson is not None, "orjson must be installed"
return orjson.dumps(content, option=orjson.OPT_INDENT_2) return orjson.dumps(content, option=orjson.OPT_INDENT_2)

View File

@ -1,7 +1,6 @@
from typing import Any from typing import Any
import pytest import pytest
from fastapi import APIRouter, FastAPI from fastapi import APIRouter, FastAPI
from fastapi.responses import HTMLResponse, JSONResponse, PlainTextResponse from fastapi.responses import HTMLResponse, JSONResponse, PlainTextResponse
from fastapi.testclient import TestClient from fastapi.testclient import TestClient
@ -12,6 +11,7 @@ class ORJSONResponse(JSONResponse):
def render(self, content: Any) -> bytes: def render(self, content: Any) -> bytes:
import orjson import orjson
return orjson.dumps(content) return orjson.dumps(content)