Plugins are ignored (?)
RiseAndCry opened this issue · 2 comments
Q | A |
---|---|
Bug? | yes |
New Feature? | no |
Version | 1.15 |
Actual Behavior
Plugins in config are ignored.
Here's my config:
httplug:
clients:
test:
factory: 'httplug.factory.curl'
http_methods_client: true
plugins:
- add_host:
host: 'test'
When i sendRequest (via Http\Client\Curl\Client), the request is never modified by the plugin (i've also tried header_defaults
plugin, to no avail). They're never called.
The error i'm getting is from Curl Client - url malformed
. Which makes sense as there is no host.
So it seems that the configuration does not work. Am i missing something or did i misconfigure it ? i did read the documentation and it seems like it should just work in this case.
Expected Behavior
Well, to work out of the box.
Steps to Reproduce
composer require php-http/httplug-bundle
- use the config above.
$httpClient = $this->container->get('httplug.client.test.client');
$httpClient->sendRequest($request);
(haven't tested but something like this)
Possible Solutions
If i manually create a PluginClient (with AddHostPlugin) and pass it CurlClient, then it works fine.
But that's not what i need.
Found the problem...
in services.yaml i was passing the Client as:
'@httplug.client.test.client'
when it was supposed to be just '@httplug.client.test'
(my option was simply passing the Curl Client instead of Curl Client wrapped in PluginClient)
glad you found that, and thanks for following up and closing your issue before we lose time trying to solve it when the problem was elsewhere.