Skip to content

Commit

Permalink
Encode $body if passed as array or object.
Browse files Browse the repository at this point in the history
  • Loading branch information
hajekj committed Jan 13, 2016
1 parent 3499bec commit 18bb6cf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Provider/Azure.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ private function request($method, $ref, $accessToken, $options = [])
$url .= (strrpos($url, "?") === false) ? "?" : "&";
$url .= "api-version=".$this->API_VERSION;

if(isset($options['body']) && (gettype($options['body']) == 'array' || gettype($options['body']) == 'object')) {
$options['body'] = json_encode($options['body']);
}
if(!isset($options['headers']['Content-Type']) && isset($options['body'])) {
$options['headers']['Content-Type'] = 'application/json';
}
Expand Down

0 comments on commit 18bb6cf

Please sign in to comment.