summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/Net/HTTP/Spore/Meta/Method.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Net/HTTP/Spore/Meta/Method.pm b/lib/Net/HTTP/Spore/Meta/Method.pm
index db990ff..21d29e6 100644
--- a/lib/Net/HTTP/Spore/Meta/Method.pm
+++ b/lib/Net/HTTP/Spore/Meta/Method.pm
@@ -221,8 +221,10 @@ sub wrap {
         my $response = $self->http_request($env);
         my $code = $response->status;
 
-        die $response if ( $method->has_expected_status
-            && !$method->find_expected_status( sub { /$code/ } ) );
+        my $ok = ($method->has_expected_status)
+            ? $method->find_expected_status( sub { $_ eq $code } )
+            : $response->is_success; # only 2xx is success
+        die $response if not $ok;
 
         $response;
     };