Bastian Hofmann

fixed post parameter passing if access token should only be sent in header

@@ -276,15 +276,22 @@ class OAuth2_Service @@ -276,15 +276,22 @@ class OAuth2_Service
276 if ($method !== 'GET') { 276 if ($method !== 'GET') {
277 if (is_array($postBody)) { 277 if (is_array($postBody)) {
278 $postBody['oauth_token'] = $token->getAccessToken(); 278 $postBody['oauth_token'] = $token->getAccessToken();
279 - $parameters = http_build_query($postBody);  
280 } else { 279 } else {
281 $postBody .= '&oauth_token=' . urlencode($token->getAccessToken()); 280 $postBody .= '&oauth_token=' . urlencode($token->getAccessToken());
282 - $parameters = $postBody;  
283 } 281 }
284 } else { 282 } else {
285 $uriParameters['oauth_token'] = $token->getAccessToken(); 283 $uriParameters['oauth_token'] = $token->getAccessToken();
286 } 284 }
287 } 285 }
  286 +
  287 + if ($method !== 'GET') {
  288 + if (is_array($postBody)) {
  289 + $parameters = http_build_query($postBody);
  290 + } else {
  291 + $parameters = $postBody;
  292 + }
  293 + }
  294 +
288 if (! empty($uriParameters)) { 295 if (! empty($uriParameters)) {
289 $endpoint .= (strpos($endpoint, '?') !== false ? '&' : '?') . http_build_query($uriParameters); 296 $endpoint .= (strpos($endpoint, '?') !== false ? '&' : '?') . http_build_query($uriParameters);
290 } 297 }