|
@@ -76,8 +76,10 @@ class Utils
|
|
public function returnJSON($content, $codeResponse = 400) {
|
|
public function returnJSON($content, $codeResponse = 400) {
|
|
|
|
|
|
json_decode($content,true);
|
|
json_decode($content,true);
|
|
- if(json_last_error() != JSON_ERROR_NONE)
|
|
|
|
- $content = json_encode(['message' => $content]);
|
|
|
|
|
|
+ if(json_last_error() != JSON_ERROR_NONE) { // error - https://cloud.google.com/storage/docs/json_api/v1/status-codes
|
|
|
|
+ $return = array('error' => array('code' => $codeResponse, 'message' => $content));
|
|
|
|
+ $content = json_encode($return);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
return new Response($content, $codeResponse, ['content-type' => 'application/json']);
|
|
return new Response($content, $codeResponse, ['content-type' => 'application/json']);
|