Skip to content

Commit

Permalink
[HOTFIX] Do not throw for HTTP errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Sep 2, 2024
1 parent d55fbf9 commit 48e30b4
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 22 deletions.
9 changes: 9 additions & 0 deletions config/services.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

return static function (ContainerConfigurator $containerConfigurator) {
$containerConfigurator->import('services/*.php');
};
1 change: 0 additions & 1 deletion config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<import resource="services/factory.xml"/>
<import resource="services/form.xml"/>
<import resource="services/generator.xml"/>
<import resource="services/http_client.xml"/>
<import resource="services/mapper.xml"/>
<import resource="services/message_handler.xml"/>
<import resource="services/middleware.xml"/>
Expand Down
30 changes: 30 additions & 0 deletions config/services/http_client.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;

return static function (ContainerConfigurator $containerConfigurator) {
$services = $containerConfigurator->services();

$services->set('webgriffe.sylius_active_campaign_plugin.http_client.handler', HandlerStack::class)
->factory([HandlerStack::class, 'create'])
->call('push', [
service('webgriffe.sylius_active_campaign_plugin.middleware.header'),
'add_active_campaign_headers',
])
;

$services->set('webgriffe.sylius_active_campaign_plugin.http_client.active_campaign', Client::class)
->args([
[
'handler' => service('webgriffe.sylius_active_campaign_plugin.http_client.handler'),
'base_uri' => param('webgriffe_sylius_active_campaign.api_client.base_url'),
'http_errors' => false,
],
])
;
};
21 changes: 0 additions & 21 deletions config/services/http_client.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;

final class WebgriffeSyliusActiveCampaignExtension extends AbstractResourceExtension
Expand All @@ -20,13 +21,15 @@ public function load(array $configs, ContainerBuilder $container): void
$config = $this->processConfiguration($this->getConfiguration([], $container), $configs);
$fileLocator = new FileLocator(__DIR__ . '/../../config');
$loader = new XmlFileLoader($container, $fileLocator);
$loader2 = new PHPFileLoader($container, $fileLocator);

$this->registerResources('webgriffe_sylius_active_campaign', $config['driver'], $config['resources'], $container);

$container->setParameter('webgriffe_sylius_active_campaign.api_client.base_url', (string) $config['api_client']['base_url']);
$container->setParameter('webgriffe_sylius_active_campaign.api_client.key', (string) $config['api_client']['key']);

$loader->load('services.xml');
$loader2->load('services.php');

$this->addMapperOptionsOnMappers($container, $config);
}
Expand Down

0 comments on commit 48e30b4

Please sign in to comment.