Skip to content

Commit 23813a7

Browse files
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 0eea373 commit 23813a7

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

service/routes/marvel.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import Annotated, Optional
88

99
from fastapi import APIRouter, Query
10-
from fastapi.responses import JSONResponse, PlainTextResponse
10+
from fastapi.responses import JSONResponse, PlainTextResponse, Response
1111

1212
from ..models import CharacterSearchBody
1313
from ..utils import ApiUtils, InvalidUsage, ReadFile
@@ -145,11 +145,16 @@ def _respond(api: ApiUtils, config: dict):
145145
raise InvalidUsage(error)
146146

147147
if config.get("pretty"):
148-
body = json.dumps(data, indent=4, separators=(",", ": "), sort_keys=False, ensure_ascii=False)
149-
else:
150-
body = json.dumps(data, sort_keys=False, ensure_ascii=False)
151-
152-
return JSONResponse(content=json.loads(body))
148+
body = json.dumps(
149+
data,
150+
indent=4,
151+
separators=(",", ": "),
152+
sort_keys=False,
153+
ensure_ascii=False,
154+
)
155+
return Response(content=body, media_type="application/json")
156+
157+
return JSONResponse(content=data)
153158

154159

155160
@bp_marvel.get(

0 commit comments

Comments
 (0)