From f17a3e7030db7717b1b84ec95709e095f1f110c1 Mon Sep 17 00:00:00 2001 From: Sergii Bondarenko Date: Fri, 2 Dec 2016 16:54:59 +0200 Subject: [PATCH] #474: Allow getting README contents in different formats --- lib/Github/Api/Repo.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Github/Api/Repo.php b/lib/Github/Api/Repo.php index cfcdbf509d6..0285f44886a 100644 --- a/lib/Github/Api/Repo.php +++ b/lib/Github/Api/Repo.php @@ -237,12 +237,15 @@ public function remove($username, $repository) * * @param string $username the user who owns the repository * @param string $repository the name of the repository + * @param string $format one of formats: "raw" or "html" * * @return array the readme content */ - public function readme($username, $repository) + public function readme($username, $repository, $format = 'raw') { - return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', [], [ + 'Accept' => "application/vnd.github.$format", + ]); } /**