--- AnyEvent-HTTP/HTTP.pm 2008/06/04 12:03:47 1.5 +++ AnyEvent-HTTP/HTTP.pm 2008/06/04 12:10:27 1.7 @@ -61,7 +61,7 @@ =item http_post $url, $body, key => value..., $cb->($data, $headers) -Executes an HTTP-POST request with a requets body of C<$bod>. See the +Executes an HTTP-POST request with a request body of C<$bod>. See the http_request function for details on additional parameters. =item http_request $method => $url, key => value..., $cb->($data, $headers) @@ -73,7 +73,7 @@ (or C if it wasn't available due to errors), and a hash-ref with response headers as second argument. -All the headers in that has are lowercased. In addition to the response +All the headers in that hash are lowercased. In addition to the response headers, the three "pseudo-headers" C, C and C contain the three parts of the HTTP Status-Line of the same name. @@ -82,6 +82,18 @@ then C<$data> will be C, C<< $headers->{Status} >> will be C<599> and the C pseudo-header will contain an error message. +A typical callback might look like this: + + sub { + my ($body, $hdr) = @_; + + if ($hdr->{Status} =~ /^2/) { + ... everything should be ok + } else { + print "error, $hdr->{Status} $hdr->{Reason}\n"; + } + } + Additional parameters are key-value pairs, and are fully optional. They include: