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.

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\Tests

Code

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.