Skip to content

Commit d557dc4

Browse files
authored
bug #881 fix: use new media type for branch protections (iBotPeaches)
This PR was squashed before being merged into the 2.15.x-dev branch. Discussion ---------- Not sure when this changed, but `loki` is not the preview anymore. It is `luke-cage`. Without this fix you won't get back branch protection values. (like required amount of reviewers). https://developer.github.com/v3/repos/branches/#get-branch-protection If you need to support commit signature crud, that has a different media type under Protections, but I don't see that supported at this time. Commits ------- 1b767b3 fix: use new media type for branch protections 3e821c4 fix: set preview header for endpoints that require it only ab9241e Revert "fix: use new media type for branch protections"
1 parent c9ccb95 commit d557dc4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/Github/Api/Repository/Protection.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public function configure()
3434
*/
3535
public function show($username, $repository, $branch)
3636
{
37+
// Preview endpoint
38+
$this->acceptHeaderValue = 'application/vnd.github.luke-cage-preview+json';
39+
3740
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection');
3841
}
3942

@@ -51,6 +54,9 @@ public function show($username, $repository, $branch)
5154
*/
5255
public function update($username, $repository, $branch, array $params = [])
5356
{
57+
// Preview endpoint
58+
$this->acceptHeaderValue = 'application/vnd.github.luke-cage-preview+json';
59+
5460
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection', $params);
5561
}
5662

0 commit comments

Comments
 (0)