From f5f20a3a983c14335ebd6a5bfced86573ec1c3d3 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 3 Mar 2011 12:33:40 -0600 Subject: allow passing arguments to the proxy app in the http backend --- lib/Plack/Client/Backend/http.pm | 22 ++++++++++++++++++++-- 1 file 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 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 constructor. + +=item proxy + +L 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; } -- cgit v1.2.3