Completed
Push — master ( 817ef8...3b19e3 )
by Daniel Rodrigues
04:25
created

EnableCors   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 9 1
1
<?php
2
3
namespace API\Http\Middleware;
4
5
use Closure;
6
7
class EnableCors
8
{
9
    /**
10
     * Handle an incoming request.
11
     *
12
     * @param  \Illuminate\Http\Request $request
13
     * @param  \Closure $next
14
     * @return mixed
15
     */
16
    public function handle($request, Closure $next)
17
    {
18
        $response = $next($request);
19
        $response->headers->set('Access-Control-Allow-Origin', '*');
20
        $response->headers->set('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT, DELETE');
21
        $response->headers->set('Access-Control-Allow-Headers', 'Content-Type, Accept, Authorization, X-Requested-With, Application');
22
23
        return $response;
24
    }
25
}
26