From 7fdbecb16ddf8dcfbe0fcbe67fbc9fe063845cd5 Mon Sep 17 00:00:00 2001 From: Dave Hall Date: Thu, 31 Oct 2013 03:36:26 -0500 Subject: [PATCH] Add mimetype support to compare() so diff/patches can be fetched --- lib/Github/Api/Repository/Commits.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Github/Api/Repository/Commits.php b/lib/Github/Api/Repository/Commits.php index 9c8726bd3b8..6753c8b5a2e 100644 --- a/lib/Github/Api/Repository/Commits.php +++ b/lib/Github/Api/Repository/Commits.php @@ -15,9 +15,13 @@ public function all($username, $repository, array $params) return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits', $params); } - public function compare($username, $repository, $base, $head) + public function compare($username, $repository, $base, $head, $mediaType = NULL) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/compare/'.rawurlencode($base).'...'.rawurlencode($head)); + $headers = array(); + if (NULL !== $mediaType) { + $headers['Accept'] = $mediaType; + } + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/compare/'.rawurlencode($base).'...'.rawurlencode($head), array(), $headers); } public function show($username, $repository, $sha)