for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Bludata\Lumen\Http\Middleware;
use Closure;
class CorsMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
if (env('APP_ENV') !== 'testing') {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, token, _');
header('Content-Type: application/json; charset=utf-8');
}
if ($request->getRealMethod() == 'OPTIONS') {
return new \Illuminate\Http\Response('OK', 200);
return $next($request);
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.