{"action":"opened","issue":{"url":"https://api.github.com/repos/php-http/HttplugBundle/issues/110","repository_url":"https://api.github.com/repos/php-http/HttplugBundle","labels_url":"https://api.github.com/repos/php-http/HttplugBundle/issues/110/labels{/name}","comments_url":"https://api.github.com/repos/php-http/HttplugBundle/issues/110/comments","events_url":"https://api.github.com/repos/php-http/HttplugBundle/issues/110/events","html_url":"https://github.com/php-http/HttplugBundle/issues/110","id":169652043,"number":110,"title":"configure base path for a client","user":{"login":"dbu","id":76576,"avatar_url":"https://avatars.githubusercontent.com/u/76576?v=3","gravatar_id":"","url":"https://api.github.com/users/dbu","html_url":"https://github.com/dbu","followers_url":"https://api.github.com/users/dbu/followers","following_url":"https://api.github.com/users/dbu/following{/other_user}","gists_url":"https://api.github.com/users/dbu/gists{/gist_id}","starred_url":"https://api.github.com/users/dbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbu/subscriptions","organizations_url":"https://api.github.com/users/dbu/orgs","repos_url":"https://api.github.com/users/dbu/repos","events_url":"https://api.github.com/users/dbu/events{/privacy}","received_events_url":"https://api.github.com/users/dbu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-05T17:02:11Z","updated_at":"2016-08-05T17:02:11Z","closed_at":null,"body":"| Q            | A\r\n| ------------ | ---\r\n| Bug?         | no\r\n| New Feature? | yes\r\n\r\n#### Actual Behavior\r\n\r\nTo configure a client with a default host, we can use the AddHostPlugin. However, this plugin can not be configured within HttplugBundle as far as i can see. I ended up doing this:\r\n\r\n```yaml\r\nparameters:\r\n    server: \"http://localhost:8001\"\r\n\r\nservices:\r\n    app.http.todo_hostname_uri:\r\n        class: Psr\\Http\\Message\\UriInterface\r\n        factory: [\"@httplug.uri_factory\", createUri]\r\n        arguments: [\"%server%\"]\r\n    app.http.plugin.todo_hostname:\r\n        class: Http\\Client\\Common\\Plugin\\AddHostPlugin\r\n        arguments: [\"@app.http.todo_hostname_uri\"]\r\n```\r\n\r\n```yaml\r\nhttplug:\r\n    clients:\r\n        todo:\r\n            factory: \"httplug.factory.guzzle6\"\r\n            plugins: [\"app.http.plugin.todo_hostname\", \"httplug.plugin.error\"]\r\n```\r\n\r\n#### Possible Solutions\r\n\r\nNot sure, but it should be easier than this imo. AddHostPlugin typehints UriInterface, and afaik we can't use a factory for an argument, hence we need to define a service for the uri object.\r\n\r\nWe could add a configuration in the `clients.{name}` space for default_host and force_host but i am not sure how well this scales with other options. maybe an options subsection?"}}
{"actor":{"display_login":"dbu"}}