Skip to content
Snippets Groups Projects
Commit ac0150a3 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2274153 by dixon_, Wim Leers: Make RESTTestBase::httpRequest() work with HEAD requests

parent 92161a9b
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -93,6 +93,7 @@ protected function httpRequest($url, $method, $body = NULL, $mime_type = NULL) { ...@@ -93,6 +93,7 @@ protected function httpRequest($url, $method, $body = NULL, $mime_type = NULL) {
$url = $this->buildUrl($url); $url = $this->buildUrl($url);
$curl_options = array();
switch ($method) { switch ($method) {
case 'GET': case 'GET':
// Set query if there are additional GET parameters. // Set query if there are additional GET parameters.
...@@ -105,6 +106,16 @@ protected function httpRequest($url, $method, $body = NULL, $mime_type = NULL) { ...@@ -105,6 +106,16 @@ protected function httpRequest($url, $method, $body = NULL, $mime_type = NULL) {
); );
break; break;
case 'HEAD':
$curl_options = array(
CURLOPT_HTTPGET => FALSE,
CURLOPT_CUSTOMREQUEST => 'HEAD',
CURLOPT_URL => $url,
CURLOPT_NOBODY => TRUE,
CURLOPT_HTTPHEADER => array('Accept: ' . $mime_type),
);
break;
case 'POST': case 'POST':
$curl_options = array( $curl_options = array(
CURLOPT_HTTPGET => FALSE, CURLOPT_HTTPGET => FALSE,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment