cors 문제 해결 .
This commit is contained in:
1 parent
dd03c2aecd
commit
b0b787a8ce
6 files changed
+25
-11
No files matched your search
@@ -3,7 +3,7 @@ import json
|
||||
from typing import Any, Union
|
||||
|
||||
from fastapi import Depends
|
||||
from fastapi.responses import ORJSONResponse
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
|
||||
import bcrypt
|
||||
from jose import jwt, JWTError, ExpiredSignatureError
|
||||
@@ -109,7 +109,8 @@ def RemoveNoneValues(obj: Any) -> Any:
|
||||
return obj
|
||||
|
||||
|
||||
def RemoveNoneResponse(obj) -> ORJSONResponse:
|
||||
def RemoveNoneResponse(obj) -> JSONResponse:
|
||||
# mode="json": uuid/datetime 등 DB 네이티브 타입(asyncpg.UUID 포함)을 pydantic 단에서
|
||||
# JSON 안전한 문자열로 변환한다. (python 모드면 orjson 이 asyncpg.UUID 를 직렬화 못 함)
|
||||
return ORJSONResponse(content=RemoveNoneValues(obj.model_dump(mode="json")))
|
||||
# JSON 안전한 문자열로 변환한다. content 가 이미 JSON-safe dict 이므로 표준 JSONResponse 사용
|
||||
# (ORJSONResponse 는 최신 FastAPI 에서 deprecated).
|
||||
return JSONResponse(content=RemoveNoneValues(obj.model_dump(mode="json")))
|
||||
Reference in new issue
Block a user