-
Notifications
You must be signed in to change notification settings - Fork 50
Add support for default_host and force_host options on each client #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
just tested it in the web summercamp tutorial app and the configuration works as expected. |
->addArgument(new Reference($uriService)) | ||
->addArgument(['replace' => true]) | ||
; | ||
if (!in_array($addHostPlugin, $plugins)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by default, we append the AddHostPlugin to the very end of the chain, but you can explicitly set it in the plugins list. i will explain this in the documentation
I do not like the new clients:
test:
factory: httplug.factory.guzzle6
http_methods_client: true
options:
default_host: http://localhost
config:
verify: false Also, we should support other plugins like Possible solution: httplug:
plugins: # Public plugins
cache:
enabled: true
cache_pool: 'my_cache_pool'
stream_factory: 'httplug.stream_factory'
config:
default_ttl: 3600
respect_cache_headers: true
logger:
enabled: true
logger: 'logger'
formatter: null
redirect:
preserve_header: true
use_default_for_multiple: true
clients:
test:
factory: httplug.factory.guzzle6
plugins: ['httplug.plugin.logger', 'httplug.plugin.cache']
http_methods_client: true
config:
verify: false
extra_plugins: # Private plugins only for this client
add_host:
host: http://localhost
replace: true
header_append:
User-Agent: 'Foobar' |
i like that idea a lot! i guess the basic question is how much we want the user to know things like adding the host are plugins, but we already went with making this transparent for the general plugins. for people not familiar with the lib, there will be a tiny confusion why something is a config and something else is an extra plugin, but i think its manageable with doc. i guess we should also repeat the public plugins in the extra_plugins of a client. so that you can have a different redirect/log/cache/whatever behaviour. and i will keep the behaviour that you can change the order by adding the private plugins in the plugins list of the client. |
see #112 |
What's in this PR?
Add new configuration options for default_host and force_host for each client.
Why?
See #110
Example Usage
You can specify the httplug.client.{name}.default|force_host_plugin in the plugins list if you dont want the host plugin to come last in the chain.
Checklist