diff options
| author | Jack Nagel | 2014-09-07 17:41:55 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-09-07 17:41:55 -0500 |
| commit | 59d9dcafd7f2ee0103272d16ffb77e519d843852 (patch) | |
| tree | a3da3036600304f8d4472f1ad35404d896e10c97 /Library | |
| parent | 1a12b98138c3f8fdb2690419ce52c363c9afd6db (diff) | |
| download | homebrew-59d9dcafd7f2ee0103272d16ffb77e519d843852.tar.bz2 | |
gist-logs: send an Accept header with the request
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Contributions/cmd/brew-gist-logs.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Library/Contributions/cmd/brew-gist-logs.rb b/Library/Contributions/cmd/brew-gist-logs.rb index 8a3a02eab..8c728aa84 100755 --- a/Library/Contributions/cmd/brew-gist-logs.rb +++ b/Library/Contributions/cmd/brew-gist-logs.rb @@ -63,12 +63,17 @@ def http end def make_request(path, data) - request = Net::HTTP::Post.new(path) - request['User-Agent'] = HOMEBREW_USER_AGENT - request['Content-Type'] = 'application/json' + headers = { + "User-Agent" => HOMEBREW_USER_AGENT, + "Accept" => "application/vnd.github.v3+json", + "Content-Type" => "application/json", + } + if HOMEBREW_GITHUB_API_TOKEN - request['Authorization'] = "token #{HOMEBREW_GITHUB_API_TOKEN}" + headers["Authorization"] = "token #{HOMEBREW_GITHUB_API_TOKEN}" end + + request = Net::HTTP::Post.new(path, headers) request.body = Utils::JSON.dump(data) request end |
