You are here

protected function ServicesWebTestCase::servicesHead in Services 7.3

Perform HEAD request.

File

tests/services.test, line 220

Class

ServicesWebTestCase

Code

protected function servicesHead($url) {
  $url = url($this
    ->getAbsoluteUrl($url) . '.php');
  $content = $this
    ->curlExec(array(
    CURLOPT_URL => $url,
    CURLOPT_CUSTOMREQUEST => 'HEAD',
    CURLOPT_HEADER => TRUE,
    CURLOPT_RETURNTRANSFER => TRUE,
  ));

  // Parse response.
  list($info, $header, $status, $code, $body) = $this
    ->parseHeader($content);
  $this
    ->verbose('HEAD request to: ' . $url . '<hr />Curl info: ' . highlight_string('<?php ' . var_export($info, TRUE), TRUE) . '<hr />Raw response: ' . $content);
  return array(
    'header' => $header,
    'status' => $status,
    'code' => $code,
    'body' => $body,
  );
}