Skip to content

Commit 2607898

Browse files
committed
pass accept as params, update protection is put not patch
1 parent e7585eb commit 2607898

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

lib/github_api/client/repos/branches/protections.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
module Github
44
# The Branch Protections API
55
class Client::Repos::Branches::Protections < API
6-
76
VALID_PROTECTION_PARAM_NAMES = %w[
87
required_status_checks
98
enforce_admins
@@ -20,7 +19,7 @@ class Client::Repos::Branches::Protections < API
2019
def get(*args)
2120
arguments(args, required: [:user, :repo, :branch])
2221

23-
get_request("/repos/#{arguments.user}/#{arguments.repo}/branches/#{arguments.branch}/protection", arguments.params)
22+
get_request("/repos/#{arguments.user}/#{arguments.repo}/branches/#{arguments.branch}/protection", arguments.params.reverse_merge({accept: 'application/vnd.github.loki-preview+json'}))
2423
end
2524
alias :find :get
2625

@@ -47,7 +46,7 @@ def edit(*args)
4746
permit VALID_PROTECTION_PARAM_NAMES
4847
end
4948

50-
patch_request("/repos/#{arguments.user}/#{arguments.repo}/branches/#{arguments.branch}/protection", arguments.params)
49+
put_request("/repos/#{arguments.user}/#{arguments.repo}/branches/#{arguments.branch}/protection", arguments.params.reverse_merge({accept: 'application/vnd.github.loki-preview+json'}))
5150
end
5251
alias :update :edit
5352

@@ -61,7 +60,7 @@ def edit(*args)
6160
def delete(*args)
6261
arguments(args, required: [:user, :repo, :branch])
6362

64-
delete_request("/repos/#{arguments.user}/#{arguments.repo}/branches/#{arguments.branch}/protection", arguments.params)
63+
delete_request("/repos/#{arguments.user}/#{arguments.repo}/branches/#{arguments.branch}/protection", arguments.params.reverse_merge({accept: 'application/vnd.github.loki-preview+json'}))
6564
end
6665
end # Client::Repos::Branches::Protections
6766
end # Github

lib/github_api/connection.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def default_headers
2323
{
2424
ACCEPT => 'application/vnd.github.v3+json,' \
2525
'application/vnd.github.beta+json;q=0.5,' \
26-
'application/vnd.github.loki-preview+json,' \
2726
'application/json;q=0.1',
2827
ACCEPT_CHARSET => 'utf-8'
2928
}

0 commit comments

Comments
 (0)