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:
authorHordur Freyr Yngvason <hfyngvason@gitlab.com>2019-09-27 14:35:37 +0300
committerHordur Freyr Yngvason <hfyngvason@gitlab.com>2019-11-21 18:09:57 +0300
commit729040717e887d33f776497eaefb8b8530dbe130 (patch)
tree5408aea2e573a7cd12b615031bb5b241952580ab /config/initializers
parentb5ad06174bb1de39438c90847abb86ac6988e944 (diff)
Use Gitlab::HTTP for all chat notifications
Diffstat (limited to 'config/initializers')
-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