diff options
| author | Jack Nagel | 2015-03-14 17:57:58 -0400 |
|---|---|---|
| committer | Jack Nagel | 2015-03-14 17:59:06 -0400 |
| commit | b03faffcc10ab7d174c8164d28739e71f9c9ce97 (patch) | |
| tree | 84d1fdaf937090bcdec307a43642b037fcf0f76c /Library/Homebrew/utils.rb | |
| parent | 2356131e5fc79983a53142a8cb71710fc97c01e8 (diff) | |
| download | brew-b03faffcc10ab7d174c8164d28739e71f9c9ce97.tar.bz2 | |
Remove unused argument
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index c6e911bdf..4b2feb053 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -326,23 +326,21 @@ module GitHub extend self 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. return if ENV['HOMEBREW_NO_GITHUB_API'] require "net/https" - default_headers = { + headers = { "User-Agent" => HOMEBREW_USER_AGENT, "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 - Kernel.open(url, default_headers.merge(headers)) do |f| - yield Utils::JSON.load(f.read) - end + Kernel.open(url, headers) { |f| yield Utils::JSON.load(f.read) } rescue OpenURI::HTTPError => e handle_api_error(e) rescue EOFError, SocketError, OpenSSL::SSL::SSLError => e |
