From 60bf6a4e52107e50e80d176223c38fcf90dfc596 Mon Sep 17 00:00:00 2001 From: Imuyu <1165290590@qq.com> Date: Fri, 12 May 2023 11:16:21 +0800 Subject: [PATCH 1/2] Update HttpClient.php --- Core/src/Http/HttpClient.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Core/src/Http/HttpClient.php b/Core/src/Http/HttpClient.php index 262b4999a..0ce373d55 100755 --- a/Core/src/Http/HttpClient.php +++ b/Core/src/Http/HttpClient.php @@ -104,7 +104,11 @@ public function doRequestSync(SdkRequest $sdkRequest) $response, 'logger' => $this->logger]); } $responseStatusCode = $response->getStatusCode(); - $requestId = $response->getHeaders()['X-Request-Id'][0]; + $requestKeys = array_filter(array_keys($response->getHeaders()), function ($key){ + return preg_match('/^x\-[a-zA-z]+\-request-id$/', (string) $key); + }); + $requestKey = array_shift($requestKeys); + $requestId = isset($response->getHeaders()[$requestKey]) ? $response->getHeaders()[$requestKey][0] : ''; $responseBody = $response->getBody(); $sdkError = $this->getSdkErrorMessage($requestId, $responseBody, $responseStatusCode); From 31f1bdae6be6857ddd9a86c2bcb10b9418ab9545 Mon Sep 17 00:00:00 2001 From: Imuyu <1165290590@qq.com> Date: Fri, 12 May 2023 11:34:05 +0800 Subject: [PATCH 2/2] Update HttpClient.php --- Core/src/Http/HttpClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/Http/HttpClient.php b/Core/src/Http/HttpClient.php index 0ce373d55..5722afa8e 100755 --- a/Core/src/Http/HttpClient.php +++ b/Core/src/Http/HttpClient.php @@ -105,7 +105,7 @@ public function doRequestSync(SdkRequest $sdkRequest) } $responseStatusCode = $response->getStatusCode(); $requestKeys = array_filter(array_keys($response->getHeaders()), function ($key){ - return preg_match('/^x\-[a-zA-z]+\-request-id$/', (string) $key); + return preg_match('/^x-([a-zA-z\-]+)?request-id$/', (string) $key); }); $requestKey = array_shift($requestKeys); $requestId = isset($response->getHeaders()[$requestKey]) ? $response->getHeaders()[$requestKey][0] : '';