handlePreflightRequest() public method

Handles a preflight request.
public handlePreflightRequest ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response
Ejemplo n.º 1
0
 /**
  * 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));
 }
Ejemplo n.º 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));
 }