Skip to content

Commit

Permalink
Merge pull request #5 from bhavingajjar/analysis-jL71wB
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
bhavingajjar committed May 27, 2020
2 parents 987f57e + 17643c6 commit 5f94a7f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Middleware/ApiHeaderInject.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
<?php

namespace Bhavingajjar\LaravelApiGenerator\Middleware;

use Closure;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Config;

class ApiHeaderInject
{
public function handle($request, Closure $next)
{
if(config('laravel-api-generator.json_response')) {
if (config('laravel-api-generator.json_response')) {
$request->headers->add([
'Accept'=>'application/json',
'Content-Type'=>'application/json'
'Content-Type'=>'application/json',
]);
}
if(config('laravel-api-generator.allow_cross_origin')) {
if (config('laravel-api-generator.allow_cross_origin')) {
$request->headers->add([
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => 'GET, POST, PUT, DELETE, OPTIONS'
'Access-Control-Allow-Methods' => 'GET, POST, PUT, DELETE, OPTIONS',
]);
}

return $next($request);
}
}

0 comments on commit 5f94a7f

Please sign in to comment.