diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-03-03 12:33:40 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-03-03 12:38:23 -0600 |
commit | f5f20a3a983c14335ebd6a5bfced86573ec1c3d3 (patch) | |
tree | e3dd6255223757ff512772f63d2299e7a30cc15f /lib | |
parent | 01bbd03aff4edaa41025bf50fa27fc6f423c7440 (diff) | |
download | plack-client-f5f20a3a983c14335ebd6a5bfced86573ec1c3d3.tar.gz plack-client-f5f20a3a983c14335ebd6a5bfced86573ec1c3d3.zip |
allow passing arguments to the proxy app in the http backend
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Plack/Client/Backend/http.pm | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/Plack/Client/Backend/http.pm b/lib/Plack/Client/Backend/http.pm index 2d53811..c5c0a7f 100644 --- a/lib/Plack/Client/Backend/http.pm +++ b/lib/Plack/Client/Backend/http.pm @@ -26,15 +26,33 @@ L<Plack::App::Proxy> to make the request. =method new -Constructor. Takes no arguments. +Constructor. Takes two optional arguments: + +=over 4 + +=item proxy_args + +Hashref of arguments to pass to the L<Plack::App::Proxy> constructor. + +=item proxy + +L<Plack::App::Proxy> object to use for requests. + +=back =cut sub new { my $class = shift; + my %args = @_; + + $args{proxy} ||= Plack::App::Proxy->new( + exists $args{proxy_args} ? $args{proxy_args} : () + ); + my $self = $class->SUPER::new(@_); - $self->{proxy} = Plack::App::Proxy->new->to_app; + $self->{proxy} = $args{proxy}->to_app; return $self; } |