From 24a133f1199117f202639642577643cc9543d718 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 7 Sep 2014 17:41:55 -0500 Subject: [PATCH] gist-logs: send an Accept header with the request --- Library/Contributions/cmd/brew-gist-logs.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Library/Contributions/cmd/brew-gist-logs.rb b/Library/Contributions/cmd/brew-gist-logs.rb index 8a3a02eab0..8c728aa845 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