Skip to content

Commit a843793

Browse files
authored
Merge pull request KnpLabs#475 from BR0kEN-/issue-474
Allow getting README contents in different formats
2 parents 32e7fb7 + f17a3e7 commit a843793

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/Github/Api/Repo.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,15 @@ public function remove($username, $repository)
237237
*
238238
* @param string $username the user who owns the repository
239239
* @param string $repository the name of the repository
240+
* @param string $format one of formats: "raw" or "html"
240241
*
241242
* @return array the readme content
242243
*/
243-
public function readme($username, $repository)
244+
public function readme($username, $repository, $format = 'raw')
244245
{
245-
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme');
246+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', [], [
247+
'Accept' => "application/vnd.github.$format",
248+
]);
246249
}
247250

248251
/**

0 commit comments

Comments
 (0)