mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-08 00:47:55 +08:00
OAuth extension adjusted to support any custom request type.
This commit is contained in:
@ -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
|
|||||||
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
|
|||||||
$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
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Exception("Unknown request method '{$method}'.");
|
$curlOptions[CURLOPT_CUSTOMREQUEST] = $method;
|
||||||
|
if (!empty($params)) {
|
||||||
|
$curlOptions[CURLOPT_POSTFIELDS] = $params;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user