bug #30612 [FrameworkBundle] fix max host connections option for XML configs (xabbuh)
This PR was merged into the 4.3-dev branch.
Discussion
----------
[FrameworkBundle] fix max host connections option for XML configs
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
3378f5e9a1
fix max host connections option for XML configs
This commit is contained in:
commit
83ff914b25
@ -486,6 +486,7 @@
|
|||||||
<xsd:element name="default-options" type="http_client_options" minOccurs="0" />
|
<xsd:element name="default-options" type="http_client_options" minOccurs="0" />
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="max-host-connections" type="xsd:integer" />
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
||||||
<xsd:complexType name="fingerprint">
|
<xsd:complexType name="fingerprint">
|
||||||
|
@ -2,11 +2,13 @@
|
|||||||
|
|
||||||
$container->loadFromExtension('framework', [
|
$container->loadFromExtension('framework', [
|
||||||
'http_client' => [
|
'http_client' => [
|
||||||
|
'max_host_connections' => 4,
|
||||||
'default_options' => [
|
'default_options' => [
|
||||||
'headers' => ['foo' => 'bar'],
|
'headers' => ['foo' => 'bar'],
|
||||||
],
|
],
|
||||||
'clients' => [
|
'clients' => [
|
||||||
'foo' => [
|
'foo' => [
|
||||||
|
'max_host_connections' => 5,
|
||||||
'default_options' => [
|
'default_options' => [
|
||||||
'headers' => ['bar' => 'baz'],
|
'headers' => ['bar' => 'baz'],
|
||||||
],
|
],
|
||||||
|
@ -6,11 +6,11 @@
|
|||||||
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
||||||
|
|
||||||
<framework:config>
|
<framework:config>
|
||||||
<framework:http-client>
|
<framework:http-client max-host-connections="4">
|
||||||
<framework:default-options>
|
<framework:default-options>
|
||||||
<framework:header name="foo">bar</framework:header>
|
<framework:header name="foo">bar</framework:header>
|
||||||
</framework:default-options>
|
</framework:default-options>
|
||||||
<framework:client name="foo">
|
<framework:client name="foo" max-host-connections="5">
|
||||||
<framework:default-options>
|
<framework:default-options>
|
||||||
<framework:header name="bar">baz</framework:header>
|
<framework:header name="bar">baz</framework:header>
|
||||||
</framework:default-options>
|
</framework:default-options>
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
framework:
|
framework:
|
||||||
http_client:
|
http_client:
|
||||||
|
max_host_connections: 4
|
||||||
default_options:
|
default_options:
|
||||||
headers: {'foo': 'bar'}
|
headers: {'foo': 'bar'}
|
||||||
clients:
|
clients:
|
||||||
foo:
|
foo:
|
||||||
|
max_host_connections: 5
|
||||||
default_options:
|
default_options:
|
||||||
headers: {'bar': 'baz'}
|
headers: {'bar': 'baz'}
|
||||||
|
@ -1389,15 +1389,17 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
{
|
{
|
||||||
$container = $this->createContainerFromFile('http_client_override_default_options');
|
$container = $this->createContainerFromFile('http_client_override_default_options');
|
||||||
|
|
||||||
$this->assertSame(['foo' => ['bar']], $container->getDefinition('http_client')->getArguments()[0]['headers']);
|
$this->assertSame(['foo' => ['bar']], $container->getDefinition('http_client')->getArgument(0)['headers']);
|
||||||
$this->assertSame(['bar' => ['baz'], 'foo' => ['bar']], $container->getDefinition('foo')->getArguments()[0]['headers']);
|
$this->assertSame(4, $container->getDefinition('http_client')->getArgument(1));
|
||||||
|
$this->assertSame(['bar' => ['baz'], 'foo' => ['bar']], $container->getDefinition('foo')->getArgument(0)['headers']);
|
||||||
|
$this->assertSame(5, $container->getDefinition('foo')->getArgument(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHttpClientFullDefaultOptions()
|
public function testHttpClientFullDefaultOptions()
|
||||||
{
|
{
|
||||||
$container = $this->createContainerFromFile('http_client_full_default_options');
|
$container = $this->createContainerFromFile('http_client_full_default_options');
|
||||||
|
|
||||||
$defaultOptions = $container->getDefinition('http_client')->getArguments()[0];
|
$defaultOptions = $container->getDefinition('http_client')->getArgument(0);
|
||||||
|
|
||||||
$this->assertSame('foo:bar', $defaultOptions['auth_basic']);
|
$this->assertSame('foo:bar', $defaultOptions['auth_basic']);
|
||||||
$this->assertSame(['foo' => 'bar', 'bar' => 'baz'], $defaultOptions['query']);
|
$this->assertSame(['foo' => 'bar', 'bar' => 'baz'], $defaultOptions['query']);
|
||||||
|
Reference in New Issue
Block a user