Better json response using laravel’s helper

This commit is contained in:
Jonny Barnes 2016-10-03 16:26:58 +01:00
parent 46f1bfd99f
commit 46ed129904

View file

@ -115,16 +115,11 @@ class MicropubController extends Controller
$valid = $this->tokenService->validateToken($token); $valid = $this->tokenService->validateToken($token);
if ($valid === null) { if ($valid === null) {
$content = <<<'EOD' return response()->json([
{ 'response' => 'error',
"respose": "error", 'error' => 'invalid_token',
"error": "invalid_token", 'error_description' => 'The provided token did not pass validation'
"error_description": "The provided token did not pass validation" ], 400);
}
EOD;
return (new Response($content, 400))
->header('Content-Type', 'application/json');
} }
//we have a valid token, is `syndicate-to` set? //we have a valid token, is `syndicate-to` set?
if ($request->input('q') === 'syndicate-to') { if ($request->input('q') === 'syndicate-to') {