Merge branch 'gogs-content-type'
This commit is contained in:
commit
361a06a127
|
@ -592,11 +592,11 @@ class WebhookController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by Gogs Webhooks:
|
|
||||||
*
|
|
||||||
* @param string $projectId
|
* @param string $projectId
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function gogs($projectId)
|
public function gogs($projectId)
|
||||||
{
|
{
|
||||||
|
@ -606,14 +606,12 @@ class WebhookController extends Controller
|
||||||
]);
|
]);
|
||||||
|
|
||||||
switch ($_SERVER['CONTENT_TYPE']) {
|
switch ($_SERVER['CONTENT_TYPE']) {
|
||||||
case 'application/json':
|
|
||||||
$payload = json_decode(file_get_contents('php://input'), true);
|
|
||||||
break;
|
|
||||||
case 'application/x-www-form-urlencoded':
|
case 'application/x-www-form-urlencoded':
|
||||||
$payload = json_decode($this->getParam('payload'), true);
|
$payload = json_decode($this->getParam('payload'), true);
|
||||||
break;
|
break;
|
||||||
|
case 'application/json':
|
||||||
default:
|
default:
|
||||||
return ['status' => 'failed', 'error' => 'Content type not supported.', 'responseCode' => 401];
|
$payload = json_decode(file_get_contents('php://input'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle Push web hooks:
|
// Handle Push web hooks:
|
||||||
|
|
Loading…
Reference in a new issue