Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ public function setupProxy($host, $port, $user = NULL, $pass = NULL)
$this->curl_opts[CURLOPT_PROXYUSERPWD] = $user . ":" . $pass;
}
}

/**
* Allow overriding of `http_build_query()` for idiosyncratic APIs
* @param mixed $data
* @return string
**/
protected function http_build_query($data) {
return http_build_query($data);
}

/**
* Perform HTTP GET request
Expand All @@ -143,7 +152,7 @@ public function get($url, $data = array(), $headers=array())
if ($pos !== false) {
$url = substr($url, 0, $pos);
}
$url .= '?' . http_build_query($data);
$url .= '?' . $this->http_build_query($data);
}

$curl_opts = $this->curl_opts;
Expand Down Expand Up @@ -410,7 +419,7 @@ public function prepData($data)
}
}

return ($multipart) ? $data : http_build_query($data);
return ($multipart) ? $data : $this->http_build_query($data);
} else {
return $data;
}
Expand Down Expand Up @@ -452,7 +461,7 @@ public function put($url, $data, $headers = array())
*/
public function patch($url, $data, $headers = array())
{
$data = (is_array($data)) ? http_build_query($data) : $data;
$data = (is_array($data)) ? $this->http_build_query($data) : $data;

$curl_opts = $this->curl_opts;
$curl_opts[CURLOPT_CUSTOMREQUEST] = 'PATCH';
Expand Down