mirror of https://github.com/tiangolo/fastapi.git
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
This commit is contained in:
parent
865927e914
commit
55931329eb
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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…
Reference in New Issue