Sfoglia il codice sorgente

Check for empty string before trying to decode. JSON module can't seem to handle these even when allow_nonref is set.

Phil Kania 14 anni fa
parent
commit
3b86e43ef9
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      lib/Selenium/Remote/RemoteConnection.pm

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

@@ -76,7 +76,7 @@ sub _process_response {
     }
     else {
         my $decoded_json = undef; 
-        if ($response->message ne 'No Content') {
+        if (($response->message ne 'No Content') && ($response->content ne '')) {
             $decoded_json = $json->allow_nonref(1)->utf8(1)->decode($response->content);
             $data->{'sessionId'} = $decoded_json->{'sessionId'};
         }