isCorsRequest() public method

Returns whether or not the request is a CORS request.
public isCorsRequest ( Request $request ) : boolean
$request Symfony\Component\HttpFoundation\Request
return boolean
 /**
  * Run the request filter.
  *
  * @param  Request $request
  * @param  Closure $next
  *
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     if (!$this->service->isCorsRequest($request)) {
         return $next($request);
     }
     if ($this->service->isPreflightRequest($request)) {
         return $this->service->handlePreflightRequest($request);
     }
     return $this->service->handleRequest($request, $next($request));
 }
Beispiel #2
0
 /**
  * Run the request filter.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  *
  * @return mixed
  */
 public function handle(Request $request, \Closure $next)
 {
     if (!$this->service->isCorsRequest($request)) {
         return $next($request);
     }
     if ($this->service->isPreflightRequest($request)) {
         return $this->service->handlePreflightRequest($request);
     }
     if (!$this->service->isRequestAllowed($request)) {
         return new Response(static::CORS_REQUEST_NOT_ALLOWED, 403);
     }
     return $this->service->handleRequest($request, $next($request));
 }