From 1b767b3786b76f4ca2b44e24b31f4449e2880ff3 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Thu, 11 Jun 2020 10:51:23 -0400 Subject: [PATCH 1/3] fix: use new media type for branch protections --- lib/Github/Api/Repository/Protection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Github/Api/Repository/Protection.php b/lib/Github/Api/Repository/Protection.php index 73d1e6b5897..3aec0eebd76 100644 --- a/lib/Github/Api/Repository/Protection.php +++ b/lib/Github/Api/Repository/Protection.php @@ -16,7 +16,7 @@ class Protection extends AbstractApi public function configure() { - $this->acceptHeaderValue = 'application/vnd.github.loki-preview+json'; + $this->acceptHeaderValue = 'application/vnd.github.luke-cage-preview+json'; return $this; } From 3e821c405cd9641b8db6582890e3ec0a1ce09f19 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Thu, 11 Jun 2020 17:07:32 -0400 Subject: [PATCH 2/3] fix: set preview header for endpoints that require it only --- lib/Github/Api/Repository/Protection.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Github/Api/Repository/Protection.php b/lib/Github/Api/Repository/Protection.php index 3aec0eebd76..b0afec22461 100644 --- a/lib/Github/Api/Repository/Protection.php +++ b/lib/Github/Api/Repository/Protection.php @@ -34,6 +34,9 @@ public function configure() */ public function show($username, $repository, $branch) { + // Preview endpoint + $this->acceptHeaderValue = 'application/vnd.github.luke-cage-preview+json'; + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection'); } @@ -51,6 +54,9 @@ public function show($username, $repository, $branch) */ public function update($username, $repository, $branch, array $params = []) { + // Preview endpoint + $this->acceptHeaderValue = 'application/vnd.github.luke-cage-preview+json'; + return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection', $params); } From ab9241ef9b57d3ba7ebaae9bbefbe6c85390dac2 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Thu, 11 Jun 2020 17:12:31 -0400 Subject: [PATCH 3/3] Revert "fix: use new media type for branch protections" This reverts commit 1b767b3786b76f4ca2b44e24b31f4449e2880ff3. --- lib/Github/Api/Repository/Protection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Github/Api/Repository/Protection.php b/lib/Github/Api/Repository/Protection.php index b0afec22461..05dc39819b8 100644 --- a/lib/Github/Api/Repository/Protection.php +++ b/lib/Github/Api/Repository/Protection.php @@ -16,7 +16,7 @@ class Protection extends AbstractApi public function configure() { - $this->acceptHeaderValue = 'application/vnd.github.luke-cage-preview+json'; + $this->acceptHeaderValue = 'application/vnd.github.loki-preview+json'; return $this; }