mirror of
https://github.com/cydrobolt/polr.git
synced 2024-11-09 19:52:28 +01:00
This commit is contained in:
parent
0fd1f44232
commit
fbb6568042
@ -51,15 +51,17 @@ class ApiController extends Controller {
|
||||
];
|
||||
|
||||
if ($response_type == 'json') {
|
||||
return json_encode($response);
|
||||
return response(json_encode($response))
|
||||
->header('Content-Type', 'application/json');
|
||||
}
|
||||
else {
|
||||
if ($plain_text_response) {
|
||||
// return alternative plain text response if provided
|
||||
return $plain_text_response;
|
||||
$result = $plain_text_response;
|
||||
}
|
||||
// assume plain text if json not requested
|
||||
return $result;
|
||||
return response($result)
|
||||
->header('Content-Type', 'text/plain');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,9 @@ class ApiLinkController extends ApiController {
|
||||
return self::encodeResponse([
|
||||
'long_url' => $link['long_url'],
|
||||
'created_at' => $link['created_at'],
|
||||
'clicks' => $link['clicks']
|
||||
'clicks' => $link['clicks'],
|
||||
'updated_at' => $link['updated_at'],
|
||||
'created_at' => $link['created_at']
|
||||
], 'lookup', $response_type, $link['long_url']);
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user