summaryrefslogtreecommitdiff
path: root/lib/bitbucket_server
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-07-27 12:58:03 -0700
committerStan Hu <stanhu@gmail.com>2018-07-27 12:58:17 -0700
commit450030e9029f5de6fcfb850e5940838c2a76c81e (patch)
tree0d34dc41be83958b8a60b24701e4b709ff5bed2b /lib/bitbucket_server
parentd27ae9f55dcf9b339c3f6d6df89853798c11f5f7 (diff)
downloadgitlab-ce-450030e9029f5de6fcfb850e5940838c2a76c81e.tar.gz
Add Accept header for JSON
Diffstat (limited to 'lib/bitbucket_server')
-rw-r--r--lib/bitbucket_server/connection.rb7
1 files changed, 6 insertions, 1 deletions
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)