-
-
Notifications
You must be signed in to change notification settings - Fork 596
Closed
Description
Currently it's impossible to get raw file contents of a JSON-encoded file (tested with v1.5.1):
$client = new Github\Client();
$api = $client->api('git_data')->blobs();
$api->configure('raw');
// fetching README.md
$contents = $api->show('KnpLabs', 'php-github-api', 'cc56952432293f57c29517b7cd556433ea5f1971');
echo gettype($contents), PHP_EOL;
// outputs "string"
// fetching composer.json
$contents = $api->show('KnpLabs', 'php-github-api', 'dc16d3e77fd4e40638cb722927ffe15fa85b1434');
echo gettype($contents), PHP_EOL;
// outputs "array"A potential solution is to make ResponseMediator content type aware and only do json_decode in cases of application/json. Another approach is to not even try to json_decode() in case of Blob API because the return value is expected to be returned as is.
Metadata
Metadata
Assignees
Labels
No labels