MDL-34290 oauthlib_helper support for POST request

This commit is contained in:
Marina Glancy
2012-08-29 11:56:16 +08:00
parent 7e1e775fa4
commit 6ec6842933
+5 -1
View File
@@ -286,7 +286,11 @@ class oauth_helper {
}
// to access protected resource, sign_secret will alwasy be consumer_secret+token_secret
$this->sign_secret = $this->consumer_secret.'&'.$secret;
$oauth_params = $this->prepare_oauth_parameters($url, array('oauth_token'=>$token), $method);
if (strtolower($method) === 'post' && !empty($params)) {
$oauth_params = $this->prepare_oauth_parameters($url, array('oauth_token'=>$token) + $params, $method);
} else {
$oauth_params = $this->prepare_oauth_parameters($url, array('oauth_token'=>$token), $method);
}
$this->setup_oauth_http_header($oauth_params);
$content = call_user_func_array(array($this->http, strtolower($method)), array($url, $params, $this->http_options));
// reset http header and options to prepare for the next request