diff options
author | franck cuny <franck@lumberjaph.net> | 2010-11-01 17:05:20 +0100 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-11-01 17:05:20 +0100 |
commit | 9c7857414d6ff485391453d326550341c2afe2aa (patch) | |
tree | b4b62e200ab6155fd09be1304e30e831ffbf2fae | |
parent | update synopsis (diff) | |
download | net-http-spore-9c7857414d6ff485391453d326550341c2afe2aa.tar.gz |
tidy; add form-data and headers
-rw-r--r-- | lib/Net/HTTP/Spore/Meta/Method.pm | 29 |
1 files changed, 19 insertions, 10 deletions
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); } |