fix middleware location and namespace

This commit is contained in:
binsky 2023-06-15 20:40:05 +02:00
parent 3c5555c7f2
commit 3a91a6b84b
2 changed files with 4 additions and 2 deletions

View file

@ -4,7 +4,7 @@ namespace OCA\Passman\Middleware;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\Response;
use \OCP\AppFramework\Middleware;
use OCP\AppFramework\Middleware;
use OCP\IRequest;
class APIMiddleware extends Middleware {
@ -19,7 +19,9 @@ class APIMiddleware extends Middleware {
if($response instanceof JSONResponse){
if(isset($this->request->server['HTTP_ORIGIN'])) {
$response->addHeader('Access-Control-Allow-Origin', $this->request->server['HTTP_ORIGIN']);
}
} else {
$response->addHeader('Access-Control-Allow-Origin', '*');
}
}
return parent::afterController($controller, $methodName, $response);
}