Commit 78daea1b by Klimov Paul

OAuth extension adjusted to support any custom request type.

parent 9c0bb748
......@@ -189,9 +189,7 @@ class OAuth1 extends BaseOAuth
}
break;
}
case 'HEAD':
case 'PUT':
case 'DELETE': {
case 'HEAD': {
$curlOptions[CURLOPT_CUSTOMREQUEST] = $method;
if (!empty($params)) {
$curlOptions[CURLOPT_URL] = $this->composeUrl($url, $params);
......@@ -199,7 +197,10 @@ class OAuth1 extends BaseOAuth
break;
}
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
$curlOptions[CURLOPT_POSTFIELDS] = http_build_query($params, '', '&', PHP_QUERY_RFC3986);
break;
}
case 'HEAD':
case 'PUT':
case 'DELETE': {
case 'HEAD': {
$curlOptions[CURLOPT_CUSTOMREQUEST] = $method;
if (!empty($params)) {
$curlOptions[CURLOPT_URL] = $this->composeUrl($url, $params);
......@@ -124,7 +122,10 @@ class OAuth2 extends BaseOAuth
break;
}
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