Skip to content

Commit 57763fb

Browse files
committed
Merge pull request #36 from php-http/auto_discovery_client
Add history plugin to the auto discovery client
2 parents c258776 + c2e2fc8 commit 57763fb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

DependencyInjection/HttplugExtension.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Http\HttplugBundle\DependencyInjection;
44

5+
use Http\Client\Plugin\PluginClient;
56
use Http\HttplugBundle\ClientFactory\DummyClient;
67
use Symfony\Component\Config\FileLocator;
78
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -88,6 +89,11 @@ protected function configureClients(ContainerBuilder $container, array $config)
8889
// Alias the first client to httplug.client.default
8990
if ($first !== null) {
9091
$container->setAlias('httplug.client.default', 'httplug.client.'.$first);
92+
} elseif (isset($config['_inject_collector_plugin'])) {
93+
// No client was configured. Make sure to inject history plugin to the auto discovery client.
94+
$container->register('httplug.client', PluginClient::class)
95+
->addArgument(new Reference('httplug.client.default'))
96+
->addArgument([new Reference('httplug.collector.history_plugin')]);
9197
}
9298
}
9399
}

0 commit comments

Comments
 (0)