private function doRequestChallenges($dns)
{
if (!is_string($dns)) {
throw new InvalidArgumentException(sprintf("\$dns must be of type string, %s given.", gettype($dns)));
}
/** @var Response $response */
$response = (yield $this->acmeClient->post(AcmeResource::NEW_AUTHORIZATION, ["identifier" => ["type" => "dns", "value" => $dns]]));
if ($response->getStatus() === 201) {
if (!$response->hasHeader("location")) {
throw new AcmeException("Protocol violation: Response didn't carry any location header.");
}
(yield new CoroutineResult([current($response->getHeader("location")), json_decode($response->getBody())]));
return;
}
throw $this->generateException($response);
}