From 9c7857414d6ff485391453d326550341c2afe2aa Mon Sep 17 00:00:00 2001 From: franck cuny Date: Mon, 1 Nov 2010 17:05:20 +0100 Subject: tidy; add form-data and headers --- lib/Net/HTTP/Spore/Meta/Method.pm | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'lib/Net/HTTP') diff --git a/lib/Net/HTTP/Spore/Meta/Method.pm b/lib/Net/HTTP/Spore/Meta/Method.pm index 10132ed..6e68b82 100644 --- a/lib/Net/HTTP/Spore/Meta/Method.pm +++ b/lib/Net/HTTP/Spore/Meta/Method.pm @@ -200,19 +200,24 @@ sub wrap { ? '' : $base_url->path ), - PATH_INFO => $method->path, - REQUEST_URI => '', - QUERY_STRING => '', - HTTP_USER_AGENT => $self->api_useragent->agent, - 'spore.expected_status' => [ $method->expected_status ], - 'spore.authentication' => $authentication, - 'spore.params' => $params, - 'spore.payload' => $payload, - 'spore.errors' => *STDERR, - 'spore.url_scheme' => $base_url->scheme, + PATH_INFO => $method->path, + REQUEST_URI => '', + QUERY_STRING => '', + HTTP_USER_AGENT => $self->api_useragent->agent, + 'spore.expected_status' => [ $method->expected_status ], + 'spore.authentication' => $authentication, + 'spore.params' => $params, + 'spore.payload' => $payload, + 'spore.errors' => *STDERR, + 'spore.url_scheme' => $base_url->scheme, 'spore.formats' => $formats, }; + $env->{'spore.form_data'} = $method->form_data + if $method->has_form_data; + + $env->{'spore.headers'} = $method->headers if $method->has_headers; + my $response = $self->http_request($env); my $code = $response->status; @@ -223,6 +228,10 @@ sub wrap { }; $args{body} = $code; + if ($args{'form-data'}){ + $args{'form_data'} = delete $args{'form-data'}; + } + $class->SUPER::wrap(%args); } -- cgit 1.4.1