Use a proxy server for the PagerDuty transport. (#12294)

* Use a proxy server for the PagerDuty transport.

We don't use the get_guzzle_proxy() function since tcp:// doesn't work
with all of the HTTP transports that Guzzle supports.  Instead we use
the standard get_proxy() function.

Tested against Squid

* formatting only
This commit is contained in:
abrezinsky
2020-11-04 08:03:48 -06:00
committed by GitHub
parent 28591c0330
commit 240edd2143

View File

@ -70,8 +70,11 @@ class Pagerduty extends Transport
$url = 'https://events.pagerduty.com/v2/enqueue';
$client = new Client();
$request_opts = ['json' => $data];
$request_opts['proxy'] = get_proxy();
try {
$result = $client->request('POST', $url, ['json' => $data]);
$result = $client->request('POST', $url, $request_opts);
if ($result->getStatusCode() == 202) {
return true;