Update plugin.php
Added full CORS policy and OPTIONS method to allow API call from JavaScript
This commit is contained in:
parent
5abddff1aa
commit
f1639a2646
1 changed files with 9 additions and 1 deletions
|
@ -69,6 +69,14 @@ class pluginAPI extends Plugin {
|
|||
// ------------------------------------------------------------
|
||||
$method = $this->getMethod();
|
||||
|
||||
// Added full CORS policy and OPTIONS method to allow API call from JS
|
||||
if ($method === 'OPTIONS'){
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Methods: GET, HEAD, OPTIONS, POST, PUT');
|
||||
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
|
||||
exit;
|
||||
}
|
||||
|
||||
// METHOD INPUTS
|
||||
// ------------------------------------------------------------
|
||||
$inputs = $this->getMethodInputs();
|
||||
|
|
Loading…
Add table
Reference in a new issue