Commit 7aad9780 authored by 谢宇轩's avatar 谢宇轩

fix: 修改中间件接口描述,更新通用的401判断

parent 33d738fe
...@@ -244,6 +244,13 @@ class Application implements ClientInterface ...@@ -244,6 +244,13 @@ class Application implements ClientInterface
throw new ApplicationException("SDK Upstream Failed", $request, []); throw new ApplicationException("SDK Upstream Failed", $request, []);
} }
if ($response->getStatusCode() == 401) {
if ($this->logger) {
$this->logger->error("sdk error, auth fail", $context);
}
throw new ApplicationException("auth Failed", $request, []);
}
try { try {
$rpcResult = $this->option->handlingPolicy()->process($response); $rpcResult = $this->option->handlingPolicy()->process($response);
} catch (GuiltyResultException $exception) { } catch (GuiltyResultException $exception) {
......
...@@ -5,5 +5,9 @@ namespace Jiwei\EasyHttpSdk\Middleware; ...@@ -5,5 +5,9 @@ namespace Jiwei\EasyHttpSdk\Middleware;
interface MiddlewareInterface interface MiddlewareInterface
{ {
/**
* @param callable $handler
* @return callable
*/
public function __invoke(callable $handler): callable;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment