Skip to content

Commit

Permalink
Merge branch 'overint-allowCORS'
Browse files Browse the repository at this point in the history
  • Loading branch information
cydrobolt committed Sep 18, 2016
2 parents f125665 + bad8059 commit a164c48
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/Http/Controllers/Api/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ protected static function encodeResponse($result, $action, $response_type='json'

if ($response_type == 'json') {
return response(json_encode($response))
->header('Content-Type', 'application/json');
->header('Content-Type', 'application/json')
->header('Access-Control-Allow-Origin', '*');
}
else {
if ($plain_text_response) {
Expand All @@ -61,7 +62,9 @@ protected static function encodeResponse($result, $action, $response_type='json'
}
// assume plain text if json not requested
return response($result)
->header('Content-Type', 'text/plain');
->header('Content-Type', 'text/plain')
->header('Access-Control-Allow-Origin', '*');

}
}
}

0 comments on commit a164c48

Please sign in to comment.