Commit 78daea1b by Klimov Paul

OAuth extension adjusted to support any custom request type.

parent 9c0bb748
...@@ -189,9 +189,7 @@ class OAuth1 extends BaseOAuth ...@@ -189,9 +189,7 @@ class OAuth1 extends BaseOAuth
} }
break; break;
} }
case 'HEAD': case 'HEAD': {
case 'PUT':
case 'DELETE': {
$curlOptions[CURLOPT_CUSTOMREQUEST] = $method; $curlOptions[CURLOPT_CUSTOMREQUEST] = $method;
if (!empty($params)) { if (!empty($params)) {
$curlOptions[CURLOPT_URL] = $this->composeUrl($url, $params); $curlOptions[CURLOPT_URL] = $this->composeUrl($url, $params);
...@@ -199,7 +197,10 @@ class OAuth1 extends BaseOAuth ...@@ -199,7 +197,10 @@ class OAuth1 extends BaseOAuth
break; break;
} }
default: { default: {
throw new Exception("Unknown request method '{$method}'."); $curlOptions[CURLOPT_CUSTOMREQUEST] = $method;
if (!empty($params)) {
$curlOptions[CURLOPT_POSTFIELDS] = $params;
}
} }
} }
......
...@@ -114,9 +114,7 @@ class OAuth2 extends BaseOAuth ...@@ -114,9 +114,7 @@ class OAuth2 extends BaseOAuth
$curlOptions[CURLOPT_POSTFIELDS] = http_build_query($params, '', '&', PHP_QUERY_RFC3986); $curlOptions[CURLOPT_POSTFIELDS] = http_build_query($params, '', '&', PHP_QUERY_RFC3986);
break; break;
} }
case 'HEAD': case 'HEAD': {
case 'PUT':
case 'DELETE': {
$curlOptions[CURLOPT_CUSTOMREQUEST] = $method; $curlOptions[CURLOPT_CUSTOMREQUEST] = $method;
if (!empty($params)) { if (!empty($params)) {
$curlOptions[CURLOPT_URL] = $this->composeUrl($url, $params); $curlOptions[CURLOPT_URL] = $this->composeUrl($url, $params);
...@@ -124,7 +122,10 @@ class OAuth2 extends BaseOAuth ...@@ -124,7 +122,10 @@ class OAuth2 extends BaseOAuth
break; break;
} }
default: { default: {
throw new Exception("Unknown request method '{$method}'."); $curlOptions[CURLOPT_CUSTOMREQUEST] = $method;
if (!empty($params)) {
$curlOptions[CURLOPT_POSTFIELDS] = $params;
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment