Skip to content

Commit 962beba

Browse files
authored
Add configure() support for issues
Borrowed from issue comments, but changed the default bodyType to "raw" since the documentation indicates that is the default when no specific media type is passed: https://developer.github.com/v3/media/#comment-body-properties
1 parent be18a9e commit 962beba

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/Github/Api/Issue.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@
1818
*/
1919
class Issue extends AbstractApi
2020
{
21+
use AcceptHeaderTrait;
22+
23+
/**
24+
* Configure the body type.
25+
*
26+
* @link https://developer.github.com/v3/issues/#custom-media-types
27+
* @param string|null $bodyType
28+
*/
29+
public function configure($bodyType = null)
30+
{
31+
if (!in_array($bodyType, array('text', 'html', 'full'))) {
32+
$bodyType = 'raw';
33+
}
34+
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $this->client->getApiVersion(), $bodyType);
35+
}
36+
2137
/**
2238
* List issues by username, repo and state.
2339
*

0 commit comments

Comments
 (0)