Check if $body is traversable before recursively sanitizing (allows for raw JSON body)
Add testRawPost()
This commit is contained in:
@@ -171,9 +171,13 @@
|
||||
|
||||
$ch = curl_init();
|
||||
if ($httpMethod != HttpMethod::GET) {
|
||||
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, $httpMethod);
|
||||
Unirest::http_build_query_for_curl($body, $postBody);
|
||||
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postBody);
|
||||
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, $httpMethod);
|
||||
if( is_array($body) || $body instanceof Traversable ) {
|
||||
Unirest::http_build_query_for_curl($body, $postBody);
|
||||
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postBody);
|
||||
} else {
|
||||
curl_setopt ($ch, CURLOPT_POSTFIELDS, $body);
|
||||
}
|
||||
} else if (is_array($body)) {
|
||||
if (strpos($url,'?') !== false) {
|
||||
$url .= "&";
|
||||
|
||||
Reference in New Issue
Block a user