Commit 8a0d326a authored by Dries's avatar Dries

- Patch #400636 by mr.baileys: improve HTTP request assertion message.

parent 4cd0dd8e
......@@ -986,7 +986,14 @@ protected function curlExec($curl_options) {
curl_setopt_array($this->curlHandle, $this->additionalCurlOptions + $curl_options);
$this->headers = array();
$this->drupalSetContent(curl_exec($this->curlHandle), curl_getinfo($this->curlHandle, CURLINFO_EFFECTIVE_URL));
$this->assertTrue($this->content !== FALSE, t('!method to !url, status is !status, response is !length bytes.', array('!method' => !empty($curl_options[CURLOPT_NOBODY]) ? 'HEAD' : (empty($curl_options[CURLOPT_POSTFIELDS]) ? 'GET' : 'POST'), '!url' => $url, '!status' => curl_getinfo($this->curlHandle, CURLINFO_HTTP_CODE), '!length' => strlen($this->content))), t('Browser'));
$message_vars = array(
'!method' => !empty($curl_options[CURLOPT_NOBODY]) ? 'HEAD' : (empty($curl_options[CURLOPT_POSTFIELDS]) ? 'GET' : 'POST'),
'@url' => $url,
'@status' => curl_getinfo($this->curlHandle, CURLINFO_HTTP_CODE),
'!length' => format_size(strlen($this->content))
);
$message = t('!method @url returned @status (!length).', $message_vars);
$this->assertTrue($this->content !== FALSE, $message, t('Browser'));
return $this->drupalGetContent();
}
......
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