From ecbac9a688e90b7385f1376b901951c2719baff8 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Wed, 23 Sep 2020 17:11:43 +1000 Subject: [PATCH] fix(webhooks): use path to initialise http request, rather than full URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is required to make the request work for the slack notifications API, which returns a 302 if the full URL is used. ¯\_(ツ)_/¯ eg. SSL established <- "POST https://hooks.slack.com/services/TOKEN vs SSL established <- "POST /services/TOKEN --- lib/pact_broker/domain/webhook_request.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pact_broker/domain/webhook_request.rb b/lib/pact_broker/domain/webhook_request.rb index 0fbe6d876..92113a8fc 100644 --- a/lib/pact_broker/domain/webhook_request.rb +++ b/lib/pact_broker/domain/webhook_request.rb @@ -59,7 +59,7 @@ def execute def http_request @http_request ||= begin - req = Net::HTTP.const_get(method.capitalize).new(url) + req = Net::HTTP.const_get(method.capitalize).new(uri.request_uri) headers.each_pair { | name, value | req[name] = value } req.basic_auth(username, password) if username && username.size > 0 req.body = body unless body.nil?