WebformTestHandlerRemotePostClientFactory.php in Webform 8.5
File
tests/modules/webform_test_handler_remote_post/src/WebformTestHandlerRemotePostClientFactory.php
View source
<?php
namespace Drupal\webform_test_handler_remote_post;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Http\ClientFactory;
use Drupal\Core\Site\Settings;
class WebformTestHandlerRemotePostClientFactory extends ClientFactory {
public function fromOptions(array $config = []) {
$default_config = [
'verify' => TRUE,
'timeout' => 30,
'headers' => [
'User-Agent' => 'Drupal/' . \Drupal::VERSION . ' (+https://www.drupal.org/) ' . \GuzzleHttp\default_user_agent(),
],
'handler' => $this->stack,
'proxy' => [
'http' => NULL,
'https' => NULL,
'no' => [],
],
];
$config = NestedArray::mergeDeep($default_config, Settings::get('http_client_config', []), $config);
return new WebformTestHandlerRemotePostClient($config);
}
}