OAuth extension adjusted to support any custom request type.

This commit is contained in:
Klimov Paul
2014-07-16 16:37:50 +03:00
parent 9c0bb74829
commit 78daea1bfb
2 changed files with 10 additions and 8 deletions

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}