22
33namespace AlibabaCloud \Client \Request \Traits ;
44
5- use GuzzleHttp \Psr7 \Uri ;
6- use AlibabaCloud \Client \SDK ;
75use AlibabaCloud \Client \AlibabaCloud ;
8- use AlibabaCloud \Client \Request \Request ;
9- use AlibabaCloud \Client \Filter \ApiFilter ;
10- use AlibabaCloud \Client \Regions \LocationService ;
116use AlibabaCloud \Client \Exception \ClientException ;
127use 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