Better json response using laravel’s helper
This commit is contained in:
parent
46f1bfd99f
commit
46ed129904
1 changed files with 5 additions and 10 deletions
|
@ -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') {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue