Browse Source

set user-agent header for github requests

pull/39/head
Aaron Parecki 7 years ago
parent
commit
19908117eb
No known key found for this signature in database GPG Key ID: 276C2817346D6056
1 changed files with 3 additions and 6 deletions
  1. +3
    -6
      lib/Formats/GitHub.php

+ 3
- 6
lib/Formats/GitHub.php View File

@ -2,7 +2,7 @@
namespace XRay\Formats; namespace XRay\Formats;
use DateTime, DateTimeZone; use DateTime, DateTimeZone;
use Parse;
use Parse, Config;
use cebe\markdown\GithubMarkdown; use cebe\markdown\GithubMarkdown;
class GitHub { class GitHub {
@ -43,9 +43,9 @@ class GitHub {
return [null, null]; return [null, null];
} }
$response = $http->get($apiurl);
$response = $http->get($apiurl, ['User-Agent: XRay ('.Config::$base.')']);
if($response['code'] != 200) { if($response['code'] != 200) {
return [null, null];
return [null, $response['body']];
} }
$data = json_decode($response['body'], true); $data = json_decode($response['body'], true);
@ -106,9 +106,6 @@ class GitHub {
$entry['published'] = $data['created_at']; $entry['published'] = $data['created_at'];
#$entry['author']
$response = [ $response = [
'data' => $entry 'data' => $entry
]; ];

Loading…
Cancel
Save