summaryrefslogtreecommitdiff
path: root/lib/bitbucket_server/connection.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-07-03 16:37:17 -0700
committerStan Hu <stanhu@gmail.com>2018-07-03 16:37:17 -0700
commitd3c75ea4d916e0c81de2e8f7c5b1d748af9fa45e (patch)
treedd51512d9c007743cb6bf7d01af1c6b6c9e12c2e /lib/bitbucket_server/connection.rb
parent5f362686ca20f2ff81f5c86a6f9be9b31177c62b (diff)
downloadgitlab-ce-d3c75ea4d916e0c81de2e8f7c5b1d748af9fa45e.tar.gz
Support creating a remote branch to import closed pull requests
Diffstat (limited to 'lib/bitbucket_server/connection.rb')
-rw-r--r--lib/bitbucket_server/connection.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/bitbucket_server/connection.rb b/lib/bitbucket_server/connection.rb
index 5c3bea3b743..21807c8a229 100644
--- a/lib/bitbucket_server/connection.rb
+++ b/lib/bitbucket_server/connection.rb
@@ -12,7 +12,6 @@ module BitbucketServer
end
def get(path, extra_query = {})
- auth = { username: username, password: token }
response = Gitlab::HTTP.get(build_url(path),
basic_auth: auth,
params: extra_query)
@@ -20,8 +19,23 @@ module BitbucketServer
response.parsed_response
end
+ def post(path, body)
+ Gitlab::HTTP.post(build_url(path),
+ basic_auth: auth,
+ headers: post_headers,
+ body: body)
+ end
+
private
+ def auth
+ @auth ||= { username: username, password: token }
+ end
+
+ def post_headers
+ @post_headers ||= { 'Content-Type' => 'application/json' }
+ end
+
def build_url(path)
return path if path.starts_with?(root_url)