From 7759dcfbad55f0109bbafd8277955262bec9b958 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq.com> Date: Thu, 12 Mar 2026 15:03:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A5=BC=E5=B1=82=E7=AE=A1=E7=90=86=E6=8E=A5?= =?UTF-8?q?=E5=8F=A32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Middleware/AdminAuthMiddleware.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/Http/Middleware/AdminAuthMiddleware.php b/app/Http/Middleware/AdminAuthMiddleware.php index 4d7e905..ab0f802 100644 --- a/app/Http/Middleware/AdminAuthMiddleware.php +++ b/app/Http/Middleware/AdminAuthMiddleware.php @@ -65,19 +65,17 @@ class AdminAuthMiddleware $contentType = $request->header('Content-Type'); if ($request->isMethod('POST') && (!$contentType - || !str_contains( - $contentType, - 'form/data' || !str_contains( $contentType, 'application/json' - ) - )) + )) ) { - return $this->responseService->error( - __('middleware.auth.use_json'), - 400 - ); + if (!str_contains($contentType, 'form-data')) { + return $this->responseService->error( + __('middleware.auth.use_json'), + 400 + ); + } } // 检查请求体是否为空对象