public function WebformTestHandlerRemotePostClientFactory::fromOptions in Webform 8.5
Same name and namespace in other branches
- 6.x tests/modules/webform_test_handler_remote_post/src/WebformTestHandlerRemotePostClientFactory.php \Drupal\webform_test_handler_remote_post\WebformTestHandlerRemotePostClientFactory::fromOptions()
Constructs a new client object from some configuration.
Parameters
array $config: The config for the client.
Return value
\GuzzleHttp\Client The HTTP client.
Overrides ClientFactory::fromOptions
File
- tests/
modules/ webform_test_handler_remote_post/ src/ WebformTestHandlerRemotePostClientFactory.php, line 19
Class
- WebformTestHandlerRemotePostClientFactory
- Extend Drupal client so that we can override Guzzel client.
Namespace
Drupal\webform_test_handler_remote_postCode
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);
}