Преглед на файлове

Don't check for html to see if the server returned an error, check content type

If the server didn't return JSON it's some sort of error, but we should not
assume that it's HTML. Sauce Labs just returns a simple text message. The code
as it was previously would look for <html>, not find it, and then blow up when
it tried to treat the text message as JSON.
Dave Rolsky преди 12 години
родител
ревизия
f04292987a
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      lib/Selenium/Remote/RemoteConnection.pm

+ 1 - 1
lib/Selenium/Remote/RemoteConnection.pm

@@ -92,7 +92,7 @@ sub _process_response {
         my $decoded_json = undef;
         print "RES: ".$response->decoded_content."\n\n" if $self->{debug};
         if (($response->message ne 'No Content') && ($response->content ne '')) {
-            if ($response->content =~ m/^<html>/i) {
+            if ($response->content_type !~ m/json/i) {
                 $data->{'cmd_return'} = 'Server returned error message '.$response->content.' instead of data';
                 return $data;
             }