diff options
author | Stan Hu <stanhu@gmail.com> | 2018-07-27 22:58:03 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-07-27 22:58:17 +0300 |
commit | 450030e9029f5de6fcfb850e5940838c2a76c81e (patch) | |
tree | 0d34dc41be83958b8a60b24701e4b709ff5bed2b /lib | |
parent | d27ae9f55dcf9b339c3f6d6df89853798c11f5f7 (diff) |
Add Accept header for JSON
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bitbucket_server/connection.rb | 7 |
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) |