Browse Source

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

pull/13946/head
svlandeg 8 months ago
parent
commit
281641a957
  1. 1
      docs_src/custom_response/tutorial009c.py
  2. 2
      tests/test_default_response_class.py

1
docs_src/custom_response/tutorial009c.py

@ -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)

2
tests/test_default_response_class.py

@ -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)

Loading…
Cancel
Save