Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RequestException有bug,抛异常也没抛到错误信息 #3

Open
jimphei opened this issue Jan 19, 2022 · 1 comment
Open

RequestException有bug,抛异常也没抛到错误信息 #3

jimphei opened this issue Jan 19, 2022 · 1 comment

Comments

@jimphei
Copy link

jimphei commented Jan 19, 2022

HttpClient.php 99 行开始,X-Request-Id要都改为小写
} catch (RequestException $e) { if ($e->hasResponse()) { $response = $e->getResponse(); if (isset($this->httpHandler)) { $this->httpHandler->processResponse(['response' => $response, 'logger' => $this->logger]); } $responseStatusCode = $response->getStatusCode(); $requestId = $response->getHeaders()['x-request-id'][0]; $responseBody = $response->getBody(); $sdkError = $this->getSdkErrorMessage($requestId, $responseBody, $responseStatusCode); if (isset($response->getHeaders()['content-length'])) { $contentLength = $response->getHeaders()['content-length'][0]; } else { $contentLength = 0; } if (isset($this->logger)) { $this->logger->addInfo(' "'.$sdkRequest->method.' '. $sdkRequest->url.'" ' .' '.$response->getStatusCode().' '.$contentLength .' '.$response->getHeaders()['x-request-id'][0]); } /* if (400 <= $responseStatusCode and $responseStatusCode < 500) { throw new ClientRequestException($responseStatusCode, $sdkError); } else { throw new ServerResponseException($responseStatusCode, $sdkError); } */ } else { $this->getExceptionType($e->getMessage()); }

@ChenwxJay
Copy link

ChenwxJay commented Sep 11, 2023

已知问题,代码将会在本周晚点更新,这里的x-request-id的解析会支持全小写(x-request-id),大部分的华为云服务是按照X-Request-Id 来返回的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants