Skip to content

Commit 767b45a

Browse files
committed
Update request args function return
1 parent e2f56f0 commit 767b45a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

backend/middleware/opera_log_middleware.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ async def dispatch(self, request: Request, call_next: Any) -> Response:
115115

116116
return response
117117

118-
async def get_request_args(self, request: Request) -> dict[str, Any]:
118+
async def get_request_args(self, request: Request) -> dict[str, Any] | None:
119119
"""
120120
获取请求参数
121121
@@ -164,20 +164,17 @@ async def get_request_args(self, request: Request) -> dict[str, Any]:
164164
else:
165165
args['form-data'] = await self.desensitization(form_data)
166166

167-
return args
167+
return None if not args else args
168168

169169
@staticmethod
170170
@sync_to_async
171-
def desensitization(args: dict[str, Any]) -> dict[str, Any] | None:
171+
def desensitization(args: dict[str, Any]) -> dict[str, Any]:
172172
"""
173173
脱敏处理
174174
175175
:param args: 需要脱敏的参数字典
176176
:return:
177177
"""
178-
if not args:
179-
return None
180-
181178
for key, value in args.items():
182179
if key in settings.OPERA_LOG_ENCRYPT_KEY_INCLUDE:
183180
match settings.OPERA_LOG_ENCRYPT_TYPE:

0 commit comments

Comments
 (0)