Permalink
Browse files

Merge pull request #3 from neilbowers/master

fixed issues with get() method
  • Loading branch information...
2 parents 3917fad + 2d1a9eb commit c72a80be47b055a515d6bac0ee8c2319353280a9 @lorn committed Feb 22, 2012
Showing with 11 additions and 8 deletions.
  1. +4 −1 Changes
  2. +7 −7 lib/LWP/Curl.pm
View
@@ -2,8 +2,11 @@ Revision history for Perl module LWP::Curl
0.10 unreleased
- - removed cookie_jar method and doc for it, as they were cut&paste from proxy method
+ - removed cookie_jar method and doc for it,
+ as they were cut&paste from proxy method
- reformatted this file according to CPAN::Changes::Spec
+ - get() wasn't croak'ing for non 2xx status codes, which was causing
+ some of the tests to fail
0.09 2011-07-10
View
@@ -235,14 +235,14 @@ sub post {
$self->{retcode} = $self->{agent}->perform;
if ( $self->{retcode} == 0 ) {
+ my $code;
- #print("Transfer went ok\n");
- #print STDERR $content;
- return $content;
-
- #my $response_code = $selfcurl->getinfo(CURLINFO_HTTP_CODE);
- }
- else {
+ $code = $self->{agent}->getinfo(CURLINFO_HTTP_CODE);
+ if ($code =~ /^2/) {
+ return $content;
+ }
+ croak "$code request not successful\n";
+ } else {
croak( "An error happened: Host $url "
. $self->{agent}->strerror( $self->{retcode} )
. " ($self->{retcode})\n" );

0 comments on commit c72a80b

Please sign in to comment.