summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorAlessio Caiazza <acaiazza@gitlab.com>2019-11-27 13:55:20 +0100
committerAlessio Caiazza <acaiazza@gitlab.com>2019-11-27 13:55:20 +0100
commita4484fd22dd0d055a10fe084b82349e42f7363e1 (patch)
tree008e49825ed1c628996c4b4cb83e33e1f33a0d74 /config
parent3269a20692c5b1f32862072d7897a4e753bae9ef (diff)
parentf220df53b6606e7e6699cc1073a6d2fa07ccdad1 (diff)
downloadgitlab-ce-a4484fd22dd0d055a10fe084b82349e42f7363e1.tar.gz
Merge remote-tracking branch 'dev/master'
Diffstat (limited to 'config')
-rw-r--r--config/initializers/hangouts_chat_http_override.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/config/initializers/hangouts_chat_http_override.rb b/config/initializers/hangouts_chat_http_override.rb
new file mode 100644
index 00000000000..4fd886697e4
--- /dev/null
+++ b/config/initializers/hangouts_chat_http_override.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+module HangoutsChat
+ class Sender
+ class HTTP
+ module GitlabHTTPOverride
+ extend ::Gitlab::Utils::Override
+
+ attr_reader :uri
+
+ # see https://github.com/enzinia/hangouts-chat/blob/6a509f61a56e757f8f417578b393b94423831ff7/lib/hangouts_chat/http.rb
+ override :post
+ def post(payload)
+ httparty_response = Gitlab::HTTP.post(
+ uri,
+ body: payload.to_json,
+ headers: { 'Content-Type' => 'application/json' },
+ parse: nil # disables automatic response parsing
+ )
+ net_http_response = httparty_response.response
+ # The rest of the integration expects a Net::HTTP response
+ net_http_response
+ end
+ end
+
+ prepend GitlabHTTPOverride
+ end
+ end
+end