protected function RESTTestBase::curlExec in Drupal 8
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.
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);
}