Commit cc6060f3 authored by Zohten's avatar Zohten

cors issue fixed

parent 18fef28e
...@@ -63,7 +63,7 @@ class Response ...@@ -63,7 +63,7 @@ class Response
header("Content-Type: application/json; charset=UTF-8"); header("Content-Type: application/json; charset=UTF-8");
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods
header("Access-Control-Allow-Methods: GET,POST,PUT,DELETE"); header("Access-Control-Allow-Methods: GET,POST,PUT,DELETE,PATCH,OPTIONS");
header("Access-Control-Max-Age: 3600"); // Maximum number of seconds the results can be cached. header("Access-Control-Max-Age: 3600"); // Maximum number of seconds the results can be cached.
......
...@@ -14,6 +14,12 @@ ...@@ -14,6 +14,12 @@
// Reify the current request // Reify the current request
$request = Request::getCurrentRequest(); $request = Request::getCurrentRequest();
// To deal with CORS issues
if ($request->getHttpMethod() === 'OPTIONS') {
Response::okResponse()->send();
}
Response::interceptEchos(); Response::interceptEchos();
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment