diff --git a/controllers/Parse.php b/controllers/Parse.php index 23321da..bc764ec 100644 --- a/controllers/Parse.php +++ b/controllers/Parse.php @@ -365,17 +365,17 @@ class Parse { $json = $request->get('json'); if($json) { // Accept GitHub JSON and parse that if provided - list($data, $json) = Formats\GitHub::parse($this->http, $url, null, $json); + list($data, $json, $code) = Formats\GitHub::parse($this->http, $url, null, $json); } else { // Otherwise fetch the post unauthenticated or with the provided access token - list($data, $json) = Formats\GitHub::parse($this->http, $url, $creds); + list($data, $json, $code) = Formats\GitHub::parse($this->http, $url, $creds); } if($data) { if($request->get('include_original')) $data['original'] = $json; $data['url'] = $url; - $data['code'] = 200; + $data['code'] = $code; return $this->respond($response, 200, $data); } else { return $this->respond($response, 200, [ @@ -383,7 +383,7 @@ class Parse { 'type' => 'unknown' ], 'url' => $url, - 'code' => 0 + 'code' => $code ]); } } diff --git a/lib/Formats/GitHub.php b/lib/Formats/GitHub.php index 3f5e0af..e4184d4 100644 --- a/lib/Formats/GitHub.php +++ b/lib/Formats/GitHub.php @@ -40,12 +40,12 @@ class GitHub { $apiurl = 'https://api.github.com/repos/'.$org.'/'.$repo.'/issues/comments/'.$comment; } else { - return [null, null]; + return [null, null, 0]; } $response = $http->get($apiurl, ['User-Agent: XRay ('.Config::$base.')']); if($response['code'] != 200) { - return [null, $response['body']]; + return [null, $response['body'], $response['code']]; } $data = json_decode($response['body'], true); @@ -54,7 +54,7 @@ class GitHub { } if(!$data) { - return [null, null]; + return [null, null, 0]; } // Start building the h-entry @@ -110,7 +110,7 @@ class GitHub { 'data' => $entry ]; - return [$response, $json]; + return [$response, $json, $response['code']]; } }