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:
Diffstat (limited to 'lib/gitlab/jira/http_client.rb')
-rw-r--r--lib/gitlab/jira/http_client.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/gitlab/jira/http_client.rb b/lib/gitlab/jira/http_client.rb
index 3e7659db240..13d3bb2b8dc 100644
--- a/lib/gitlab/jira/http_client.rb
+++ b/lib/gitlab/jira/http_client.rb
@@ -40,6 +40,14 @@ module Gitlab
@authenticated = result.response.is_a?(Net::HTTPOK)
store_cookies(result) if options[:use_cookies]
+ # This is needed to make response.to_s work. HTTParty::Response internal uses a Net::HTTPResponse as @response.
+ # When a block is used, Net::HTTPResponse#body will be a Net::ReadAdapter instead of a String.
+ # In this case HTTParty::Response.to_s will default to inspecting the Net::HTTPResponse class instead
+ # of returning the content of body.
+ # See https://github.com/jnunemaker/httparty/blob/v0.18.1/lib/httparty/response.rb#L86-L92
+ # See https://github.com/ruby/net-http/blob/v0.1.1/lib/net/http/response.rb#L346-L350
+ result.response.body = result.body
+
result
end