diff --git a/ClientAbstracts.php b/ClientAbstracts.php index 7dbd55f..7614b68 100644 --- a/ClientAbstracts.php +++ b/ClientAbstracts.php @@ -331,10 +331,6 @@ abstract class ClientAbstracts implements IClient protected function withHost(string $host): static { $this->host = $host; - if (Context::inCoroutine() && !preg_match('/(\d{1,3}\.){3}\d{1,3}/', $host)) { - $this->host = System::gethostbyname($host); - $this->withAddedHeader('Host', $host); - } return $this; } diff --git a/CoroutineClient.php b/CoroutineClient.php index 397d9c0..1fd7d6c 100644 --- a/CoroutineClient.php +++ b/CoroutineClient.php @@ -37,8 +37,7 @@ class CoroutineClient extends ClientAbstracts } $host = $this->getHost(); if (!preg_match('/(\d{1,3}\.){3}\d{1,3}/', $host)) { - $this->withHost(System::gethostbyname($host)); - $this->withAddedHeader('Host', $host); + $this->withHost(System::gethostbyname($host))->withAddedHeader('Host', $host); } $this->withMethod($method) ->coroutine(