Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-07-13 09:17:05 +0300
committerStan Hu <stanhu@gmail.com>2018-07-13 09:17:05 +0300
commitec4109d413f6161b43ad4cc1a6251af30d3bcf03 (patch)
treec2db2b3ae4335752d014d43516526fca48187cf0 /lib/bitbucket_server
parent15220291ae1752b9e36ad0b2320180614ec37c59 (diff)
Make Connection#post consistent with Connection#get and add specs
Diffstat (limited to 'lib/bitbucket_server')
-rw-r--r--lib/bitbucket_server/connection.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/bitbucket_server/connection.rb b/lib/bitbucket_server/connection.rb
index 0e7817fc82e..853d09b776a 100644
--- a/lib/bitbucket_server/connection.rb
+++ b/lib/bitbucket_server/connection.rb
@@ -33,22 +33,22 @@ module BitbucketServer
check_errors!(response)
- response
+ response.parsed_response
end
private
def check_errors!(response)
- if response.code != 200
- error =
- if response.parsed_response && response.parsed_response.is_a?(Hash)
- sanitize(response.parsed_response.dig('errors', 0, 'message'))
- end
-
- message = "Error #{response.code}"
- message += ": #{error}" if error
- raise ConnectionError, message
- end
+ return if response.code == 200
+
+ details =
+ if response.parsed_response && response.parsed_response.is_a?(Hash)
+ sanitize(response.parsed_response.dig('errors', 0, 'message'))
+ end
+
+ message = "Error #{response.code}"
+ message += ": #{details}" if details
+ raise ConnectionError, message
end
def auth