Skip to content

Commit 6f033f7

Browse files
committed
Fixed raw blob retrieval
1 parent cfe9ae0 commit 6f033f7

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/Github/Api/GitData/Blobs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function configure($bodyType = null)
1515
{
1616
if ('raw' == $bodyType) {
1717
$this->client->setHeaders(array(
18-
sprintf('Accept: application/vnd.github.%s.raw', $this->client->getOption('api_version'))
18+
'Accept' => sprintf('application/vnd.github.%s.raw', $this->client->getOption('api_version'))
1919
));
2020
}
2121
}

test/Github/Tests/Functional/RepoTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@ public function shouldShowPRDiffIfHeaderIsPresent()
2424
$this->assertTrue('string' === gettype($diff));
2525
}
2626

27+
/**
28+
* @test
29+
*/
30+
public function shouldRetrieveRawBlob()
31+
{
32+
$api = $this->client->api('git_data')->blobs();
33+
$api->configure('raw');
34+
35+
$contents = $api->show(
36+
'KnpLabs',
37+
'php-github-api',
38+
'e50d5e946385cff052636e2f09f36b03d1c368f4'
39+
);
40+
41+
$this->assertInternalType('string', $contents);
42+
$this->assertStringStartsWith('<?php', $contents);
43+
}
44+
2745
/**
2846
* @test
2947
*/

0 commit comments

Comments
 (0)