Permalink
Browse files

add internal error response message to status message.

  • Loading branch information...
1 parent 0e6421a commit 3feeec25f2a4b0005bab151eeaf3f58b5635a901 @tokuhirom tokuhirom committed Dec 21, 2010
Showing with 7 additions and 7 deletions.
  1. +1 −1 lib/Furl/HTTP.pm
  2. +1 −1 t/100_low/06_errors.t
  3. +2 −2 t/100_low/07_timeout.t
  4. +3 −3 t/200_online/05_connect_error.t
View
@@ -756,7 +756,7 @@ sub write_all {
sub _r500 {
my($self, $message) = @_;
$message = Carp::shortmess($message); # add lineno and filename
- return(0, 500, 'Internal Server Error',
+ return(0, 500, "Internal Response: $message",
['Content-Length' => length($message)], $message);
}
@@ -71,7 +71,7 @@ test_tcp(
headers => [ "X-Foo" => "ppp" ]
);
is $code, 500, "request()/$_";
- is $msg, "Internal Server Error";
+ like $msg, qr/Internal Response: Unexpected EOF while reading response header/;
is ref($headers), "ARRAY";
ok $content, 'content: ' . $content;
}
@@ -30,7 +30,7 @@ test_tcp(
);
my $elapsed = time - $start_at;
is $code, 500, "request()/$_";
- is $msg, "Internal Server Error";
+ like $msg, qr/Internal Response: Cannot read response header: timeout/;
is ref($headers), "ARRAY";
ok $content, 'content: ' . $content;
ok 1.3 <= $elapsed && $elapsed <= 2;
@@ -55,7 +55,7 @@ test_tcp(
);
my $elapsed = time - $start_at;
is $code, 500, "request()/$_";
- is $msg, "Internal Server Error";
+ like $msg, qr/Internal Response: Failed to send content: timeout/;
is ref($headers), "ARRAY";
ok $content, 'content: ' . $content;
ok 0.4 <= $elapsed && $elapsed <= 1;
@@ -20,7 +20,7 @@ note 'name resolution error';
path_query => '/foo',
);
is $code, 500, "nameerror/$_";
- is $msg, 'Internal Server Error';
+ like $msg, qr/Internal Response: Cannot resolve host name: a/;
is ref($headers), 'ARRAY';
ok $content, "content: $content";
}
@@ -40,7 +40,7 @@ note 'refused error';
);
my $elapsed = time - $start_at;
is $code, 500, "request/$scheme/$_";
- is $msg, 'Internal Server Error';
+ like $msg, qr/Internal Response: (Cannot connect to 255.255.255.255:80:|Cannot create SSL connection:)/;
is ref($headers), 'ARRAY';
ok $content, "content: $content";
ok $elapsed < 0.5;
@@ -63,7 +63,7 @@ for my $scheme (qw(http)) {
);
my $elapsed = time - $start_at;
is $code, 500, "request/$scheme/timeout/$timeout";
- is $msg, 'Internal Server Error';
+ like $msg, qr/Internal Response: Cannot connect to google.com:81:/;
is ref($headers), 'ARRAY';
ok $content, "content: $content";
ok $timeout - 0.1 <= $elapsed && $elapsed <= $timeout + 1, "elapsed: $elapsed";

0 comments on commit 3feeec2

Please sign in to comment.