Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.

### Fixed

- Fix to pass only allowed options to the `ContentTypePlugin`.

## 1.15.1 - 2019-04-12

### Fixed
Expand Down
2 changes: 2 additions & 0 deletions src/DependencyInjection/HttplugExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ private function configurePluginByName($name, Definition $definition, array $con
break;

case 'content_type':
unset($config['enabled']);
$definition->replaceArgument(0, $config);

break;

case 'header_append':
Expand Down
5 changes: 5 additions & 0 deletions tests/Resources/Fixtures/config/full.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
'uri' => 'http://localhost',
],
],
[
'content_type' => [
'skip_detection' => true,
],
],
[
'header_set' => [
'headers' => [
Expand Down
3 changes: 3 additions & 0 deletions tests/Resources/Fixtures/config/full.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<plugin>
<base-uri uri="http://localhost"/>
</plugin>
<plugin>
<content-type skip-detection="true"/>
</plugin>
<plugin>
<header-set>
<header name="X-FOO">bar</header>
Expand Down
3 changes: 3 additions & 0 deletions tests/Resources/Fixtures/config/full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ httplug:
-
base_uri:
uri: http://localhost
-
content_type:
skip_detection: true
-
header_set:
headers:
Expand Down
6 changes: 6 additions & 0 deletions tests/Unit/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ public function testSupportsAllConfigFormats()
'replace' => false,
],
],
[
'content_type' => [
'enabled' => true,
'skip_detection' => true,
],
],
[
'header_set' => [
'enabled' => true,
Expand Down
26 changes: 26 additions & 0 deletions tests/Unit/DependencyInjection/HttplugExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,32 @@ public function testCachePluginConfigCacheKeyGeneratorReference()
$this->assertSame('header_cache_key_generator', (string) $config['cache_key_generator']);
}

public function testContentTypePluginAllowedOptions()
{
$this->load([
'clients' => [
'acme' => [
'plugins' => [
[
'content_type' => [
'skip_detection' => true,
'size_limit' => 200000,
],
],
],
],
],
]);

$cachePlugin = $this->container->findDefinition('httplug.client.acme.plugin.content_type');

$config = $cachePlugin->getArgument(0);
$this->assertEquals([
'skip_detection' => true,
'size_limit' => 200000,
], $config);
}

public function testUsingServiceKeyForClients()
{
$this->load([
Expand Down