Skip to content

Commit cfe9ae0

Browse files
committed
Merge pull request #96 from KnpLabs/fix/clear-headers
Fix clearHeaders to use array keys instead of plain text
2 parents a51fef9 + 5911c3d commit cfe9ae0

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

lib/Github/HttpClient/HttpClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public function setHeaders(array $headers)
7272
public function clearHeaders()
7373
{
7474
$this->headers = array(
75-
sprintf('Accept: application/vnd.github.%s+json', $this->options['api_version']),
76-
sprintf('User-Agent: %s', $this->options['user_agent']),
75+
'Accept' => sprintf('application/vnd.github.%s+json', $this->options['api_version']),
76+
'User-Agent' => sprintf('%s', $this->options['user_agent']),
7777
);
7878
}
7979

test/Github/Tests/Functional/RepoTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@
77
*/
88
class RepoTest extends TestCase
99
{
10+
/**
11+
* @test
12+
*/
13+
public function shouldShowPRDiffIfHeaderIsPresent()
14+
{
15+
$this->client->setHeaders(
16+
array('Accept' => sprintf(
17+
'application/vnd.github.%s.diff',
18+
$this->client->getOption('api_version')
19+
))
20+
);
21+
22+
$diff = $this->client->api('pull_request')->show('KnpLabs', 'php-github-api', '92');
23+
24+
$this->assertTrue('string' === gettype($diff));
25+
}
26+
1027
/**
1128
* @test
1229
*/

0 commit comments

Comments
 (0)