Version 1
[yaffs-website] / web / core / lib / Drupal / Core / DependencyInjection / Compiler / GuzzleMiddlewarePass.php
diff --git a/web/core/lib/Drupal/Core/DependencyInjection/Compiler/GuzzleMiddlewarePass.php b/web/core/lib/Drupal/Core/DependencyInjection/Compiler/GuzzleMiddlewarePass.php
new file mode 100644 (file)
index 0000000..91b3580
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+namespace Drupal\Core\DependencyInjection\Compiler;
+
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+
+class GuzzleMiddlewarePass implements CompilerPassInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function process(ContainerBuilder $container) {
+    $middleware_ids = array_keys($container->findTaggedServiceIds('http_client_middleware'));
+    $container->getDefinition('http_handler_stack_configurator')
+      ->addArgument($middleware_ids);
+  }
+
+}