Remove unused argument
This commit is contained in:
parent
2356131e5f
commit
b03faffcc1
@ -326,23 +326,21 @@ module GitHub extend self
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def open url, headers={}, &block
|
def open(url, &block)
|
||||||
# This is a no-op if the user is opting out of using the GitHub API.
|
# This is a no-op if the user is opting out of using the GitHub API.
|
||||||
return if ENV['HOMEBREW_NO_GITHUB_API']
|
return if ENV['HOMEBREW_NO_GITHUB_API']
|
||||||
|
|
||||||
require "net/https"
|
require "net/https"
|
||||||
|
|
||||||
default_headers = {
|
headers = {
|
||||||
"User-Agent" => HOMEBREW_USER_AGENT,
|
"User-Agent" => HOMEBREW_USER_AGENT,
|
||||||
"Accept" => "application/vnd.github.v3+json",
|
"Accept" => "application/vnd.github.v3+json",
|
||||||
}
|
}
|
||||||
|
|
||||||
default_headers['Authorization'] = "token #{HOMEBREW_GITHUB_API_TOKEN}" if HOMEBREW_GITHUB_API_TOKEN
|
headers["Authorization"] = "token #{HOMEBREW_GITHUB_API_TOKEN}" if HOMEBREW_GITHUB_API_TOKEN
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Kernel.open(url, default_headers.merge(headers)) do |f|
|
Kernel.open(url, headers) { |f| yield Utils::JSON.load(f.read) }
|
||||||
yield Utils::JSON.load(f.read)
|
|
||||||
end
|
|
||||||
rescue OpenURI::HTTPError => e
|
rescue OpenURI::HTTPError => e
|
||||||
handle_api_error(e)
|
handle_api_error(e)
|
||||||
rescue EOFError, SocketError, OpenSSL::SSL::SSLError => e
|
rescue EOFError, SocketError, OpenSSL::SSL::SSLError => e
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user