Skip to content

Commit 66cb286

Browse files
committed
Host Resolver Added
1 parent 900c5b1 commit 66cb286

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

src/Request/Traits/AcsTrait.php

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
namespace AlibabaCloud\Client\Request\Traits;
44

5-
use GuzzleHttp\Psr7\Uri;
6-
use AlibabaCloud\Client\SDK;
75
use AlibabaCloud\Client\AlibabaCloud;
8-
use AlibabaCloud\Client\Request\Request;
9-
use AlibabaCloud\Client\Filter\ApiFilter;
10-
use AlibabaCloud\Client\Regions\LocationService;
116
use AlibabaCloud\Client\Exception\ClientException;
127
use AlibabaCloud\Client\Exception\ServerException;
8+
use AlibabaCloud\Client\Filter\ApiFilter;
9+
use AlibabaCloud\Client\Regions\LocationService;
10+
use AlibabaCloud\Client\Request\Request;
11+
use AlibabaCloud\Client\SDK;
12+
use GuzzleHttp\Psr7\Uri;
1313

1414
/**
1515
* Trait AcsTrait
@@ -200,8 +200,24 @@ private function resolveHostWays(&$host, $region_id)
200200
$host = $this->endpointMap[$region_id];
201201
}
202202

203+
if (!$host) {
204+
$this->hostResolver($host, $region_id);
205+
}
206+
}
207+
208+
/**
209+
* @codeCoverageIgnore
210+
*
211+
* @param string $host
212+
* @param string $region_id
213+
*
214+
* @throws ClientException
215+
* @throws ServerException
216+
*/
217+
private function hostResolver(&$host, $region_id)
218+
{
203219
// 2. Find host by rules.
204-
if (!$host && $this->endpointRegional !== null) {
220+
if ($this->endpointRegional !== null) {
205221
$host = AlibabaCloud::resolveHostByRule($this);
206222
}
207223

@@ -214,6 +230,7 @@ private function resolveHostWays(&$host, $region_id)
214230
if (!$host && $this->serviceCode) {
215231
$host = LocationService::resolveHost($this);
216232
}
233+
217234
}
218235

219236
/**

0 commit comments

Comments
 (0)