Browse Source

fix arrays

pull/39/head
Aaron Parecki 7 years ago
parent
commit
2796897a61
No known key found for this signature in database GPG Key ID: 276C2817346D6056
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      controllers/Rels.php

+ 4
- 1
controllers/Rels.php View File

@ -17,7 +17,7 @@ class Rels {
$response->headers->set($k, $v); $response->headers->set($k, $v);
} }
$response->headers->set('Content-Type', 'application/json'); $response->headers->set('Content-Type', 'application/json');
$opts = JSON_UNESCAPED_SLASHES + JSON_FORCE_OBJECT;
$opts = JSON_UNESCAPED_SLASHES;
if($this->_pretty) $opts += JSON_PRETTY_PRINT; if($this->_pretty) $opts += JSON_PRETTY_PRINT;
$response->setContent(json_encode($params, $opts)."\n"); $response->setContent(json_encode($params, $opts)."\n");
return $response; return $response;
@ -83,6 +83,9 @@ class Rels {
} }
} }
if(count($rels) == 0)
$rels = new StdClass;
return $this->respond($response, 200, [ return $this->respond($response, 200, [
'url' => $result['url'], 'url' => $result['url'],
'code' => $result['code'], 'code' => $result['code'],

Loading…
Cancel
Save