From 48a4c17c2bd051b49ec2bda7d7b12ecf1c7b8a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=9E=9C=E7=9A=84=E5=A6=82=E6=9E=9C?= Date: Tue, 20 Aug 2024 23:52:15 +0800 Subject: [PATCH] =?UTF-8?q?fix=20ParamFrom::Header=20=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E5=86=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Attributes/Param.php | 3 ++- src/Enum/ParamFrom.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Attributes/Param.php b/src/Attributes/Param.php index baf3b34..7d82e79 100644 --- a/src/Attributes/Param.php +++ b/src/Attributes/Param.php @@ -196,7 +196,8 @@ public function parsedValue(?ServerRequestInterface $request = null) break; } case ParamFrom::HEADER:{ - $data = $request->getHeader($this->name); + //swoole header的key,全部都是小写 + $data = $request->getHeader(strtolower($this->name)); $this->hasSet = true; if(!empty($data)){ $this->value = $data[0]; diff --git a/src/Enum/ParamFrom.php b/src/Enum/ParamFrom.php index 8b7437f..e179c77 100644 --- a/src/Enum/ParamFrom.php +++ b/src/Enum/ParamFrom.php @@ -13,7 +13,7 @@ enum ParamFrom case DI; case CONTEXT; case COOKIE; - case HEADER; + case HEADER;//swoole header的key,全部都是小写 case ROUTER_PARAMS; public function toString():string