Skip to content

Commit 7fdbecb

Browse files
committed
Add mimetype support to compare() so diff/patches can be fetched
1 parent 1a1817b commit 7fdbecb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/Github/Api/Repository/Commits.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ public function all($username, $repository, array $params)
1515
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits', $params);
1616
}
1717

18-
public function compare($username, $repository, $base, $head)
18+
public function compare($username, $repository, $base, $head, $mediaType = NULL)
1919
{
20-
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/compare/'.rawurlencode($base).'...'.rawurlencode($head));
20+
$headers = array();
21+
if (NULL !== $mediaType) {
22+
$headers['Accept'] = $mediaType;
23+
}
24+
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/compare/'.rawurlencode($base).'...'.rawurlencode($head), array(), $headers);
2125
}
2226

2327
public function show($username, $repository, $sha)

0 commit comments

Comments
 (0)