From 450030e9029f5de6fcfb850e5940838c2a76c81e Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 27 Jul 2018 12:58:03 -0700 Subject: Add Accept header for JSON --- lib/bitbucket_server/connection.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/bitbucket_server') diff --git a/lib/bitbucket_server/connection.rb b/lib/bitbucket_server/connection.rb index 8a3775bd152..2d438ae8ca1 100644 --- a/lib/bitbucket_server/connection.rb +++ b/lib/bitbucket_server/connection.rb @@ -20,6 +20,7 @@ module BitbucketServer def get(path, extra_query = {}) response = Gitlab::HTTP.get(build_url(path), basic_auth: auth, + headers: accept_headers, query: extra_query) check_errors!(response) @@ -74,8 +75,12 @@ module BitbucketServer @auth ||= { username: username, password: token } end + def accept_headers + @accept_headers ||= { 'Accept' => 'application/json' } + end + def post_headers - @post_headers ||= { 'Content-Type' => 'application/json' } + @post_headers ||= accept_headers.merge({ 'Content-Type' => 'application/json' }) end def build_url(path) -- cgit v1.2.3