function ServicesWebTestCase::parseHeader in Services 6.3
Same name and namespace in other branches
- 7.3 tests/services.test \ServicesWebTestCase::parseHeader()
Parse header.
Parameters
type $content:
Return value
type
4 calls to ServicesWebTestCase::parseHeader()
- ServicesWebTestCase::servicesDelete in tests/
functional/ ServicesWebTestCase.php - ServicesWebTestCase::servicesGet in tests/
functional/ ServicesWebTestCase.php - ServicesWebTestCase::servicesPost in tests/
functional/ ServicesWebTestCase.php - ServicesWebTestCase::servicesPut in tests/
functional/ ServicesWebTestCase.php
File
- tests/
functional/ ServicesWebTestCase.php, line 143 - Services base testing class.
Class
- ServicesWebTestCase
- @file Services base testing class.
Code
function parseHeader($content, $call_type = 'php') {
$info = curl_getinfo($this->curlHandle);
$header = drupal_substr($content, 0, $info['header_size']);
$header = str_replace("HTTP/1.1 100 Continue\r\n\r\n", '', $header);
$status = strtok($header, "\r\n");
$code = $info['http_code'];
$raw_body = drupal_substr($content, $info['header_size'], drupal_strlen($content) - $info['header_size']);
switch ($call_type) {
case 'php':
$body = unserialize($raw_body);
break;
case 'json':
$body = json_decode($raw_body);
break;
}
return array(
$info,
$header,
$status,
$code,
$body,
);
}