File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -2588,20 +2588,20 @@ protected function swagger($settings) {
25882588 }
25892589
25902590 protected function allowOrigin ($ origin ,$ allowOrigins ) {
2591- if ($ origin ) foreach (explode (', ' ,$ allowOrigins ) as $ o ) {
2592- if (preg_match ('/^ ' .str_replace ('\* ' ,'.* ' ,preg_quote (strtolower (trim ($ o )))).'$/ ' ,$ origin )) {
2593- header ('Access-Control-Allow-Origin: ' .$ origin );
2594- break ;
2591+ if (isset ($ _SERVER ['REQUEST_METHOD ' ])) {
2592+ header ('Access-Control-Allow-Credentials: true ' );
2593+ foreach (explode (', ' ,$ allowOrigins ) as $ o ) {
2594+ if (preg_match ('/^ ' .str_replace ('\* ' ,'.* ' ,preg_quote (strtolower (trim ($ o )))).'$/ ' ,$ origin )) {
2595+ header ('Access-Control-Allow-Origin: ' .$ origin );
2596+ break ;
2597+ }
25952598 }
2596- } else {
2597- header ('Access-Control-Allow-Origin: * ' );
25982599 }
25992600 }
26002601
26012602 public function executeCommand () {
2602- if (isset ( $ _SERVER [ ' REQUEST_METHOD ' ]) ) {
2603+ if ($ this -> settings [ ' origin ' ] ) {
26032604 $ this ->allowOrigin ($ this ->settings ['origin ' ],$ this ->settings ['allow_origin ' ]);
2604- header ('Access-Control-Allow-Credentials: true ' );
26052605 }
26062606 if (!$ this ->settings ['request ' ]) {
26072607 $ this ->swagger ($ this ->settings );
You can’t perform that action at this time.
0 commit comments