From 685617267f5aa73a4bbcb13303b5e7037d5b8194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Thu, 4 May 2023 22:58:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E6=97=A0=20headers=20?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WePayV3/Contracts/BasicWePay.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/WePayV3/Contracts/BasicWePay.php b/WePayV3/Contracts/BasicWePay.php index 82548f9..6010099 100644 --- a/WePayV3/Contracts/BasicWePay.php +++ b/WePayV3/Contracts/BasicWePay.php @@ -175,9 +175,12 @@ abstract class BasicWePay } } try { + if (empty($headers)) { + return $isjson ? json_decode($content, true) : $content; + } $string = join("\n", [$headers['timestamp'], $headers['nonce'], $content, '']); if (!$this->signVerify($string, $headers['signature'], $headers['serial'])) { - throw new InvalidResponseException("验证响应签名失败"); + throw new InvalidResponseException('验证响应签名失败'); } } catch (\Exception $exception) { throw new InvalidResponseException($exception->getMessage(), $exception->getCode());