Allow multiple request methods per callback.

This commit is contained in:
Michael McAndrew 2018-03-12 10:25:31 +00:00
parent 5dedecb2f3
commit abd31ca0ef
2 changed files with 8 additions and 4 deletions

View File

@ -1,9 +1,13 @@
<?php <?php
function civiproxy_callback_validate_request_method($expected, $actual){ function civiproxy_callback_validate_request_method($expected, $actual){
if($expected != $actual){ if(is_array($expected) && in_array($actual, $expected)){
civiproxy_http_error("Invalid request method.", 405); return;
} }
if(is_string($expected) && $expected == $actual){
return;
}
civiproxy_http_error("Invalid request method.", 405);
} }
function civiproxy_callback_validate_content_type($expected, $actual){ function civiproxy_callback_validate_content_type($expected, $actual){

View File

@ -122,8 +122,8 @@ $callbacks_enabled = false;
$callbacks = [ $callbacks = [
'sparkpost' => [ 'sparkpost' => [
// 'secret' => '', 'secret' => '85c573b980c3c248f083f9ca6a175659',
'request_method' => 'POST', 'request_method' => 'POST', // single value or array
'content_type' => 'application/json', 'content_type' => 'application/json',
'target_path' => 'civicrm/sparkpost/callback' 'target_path' => 'civicrm/sparkpost/callback'
] ]