function RESTTestBase::curlExec
This method is overridden to deal with a cURL quirk: the usage of CURLOPT_CUSTOMREQUEST cannot be unset on the cURL handle, so we need to override it every time it is omitted.
Parameters
$curl_options: An associative array of cURL options to set, where the keys are constants defined by the cURL library. For a list of valid options, see http://php.net/manual/function.curl-setopt.php
$redirect: FALSE if this is an initial request, TRUE if this request is the result of a redirect.
Return value
The content returned from the call to curl_exec().
Overrides WebTestBase::curlExec
File
-
core/
modules/ rest/ src/ Tests/ RESTTestBase.php, line 441
Class
- RESTTestBase
- Test helper class that provides a REST client method to send HTTP requests.
Namespace
Drupal\rest\TestsCode
protected function curlExec($curl_options, $redirect = FALSE) {
unset($this->response);
if (!isset($curl_options[CURLOPT_CUSTOMREQUEST])) {
if (!empty($curl_options[CURLOPT_HTTPGET])) {
$curl_options[CURLOPT_CUSTOMREQUEST] = 'GET';
}
if (!empty($curl_options[CURLOPT_POST])) {
$curl_options[CURLOPT_CUSTOMREQUEST] = 'POST';
}
}
return parent::curlExec($curl_options, $redirect);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.