Bug 1461463 - [geckodriver] Empty response value should be null and not {}. draft
authorHenrik Skupin <mail@hskupin.info>
Thu, 17 May 2018 15:56:39 +0200
changeset 800975 a72d1d92e396b65af97fd29f2d4aa076751a42d5
parent 800974 22501a95c09e371c173ae8d61562ab69d34d6957
child 800976 0518792ebf5b08c512a2a63c8b71ea5387407271
push id111539
push userbmo:hskupin@gmail.com
push dateTue, 29 May 2018 15:41:27 +0000
bugs1461463
milestone62.0a1
Bug 1461463 - [geckodriver] Empty response value should be null and not {}. WebDriver commands which do not return a value have to send null. But currently geckodriver returns an empty object. MozReview-Commit-ID: EEmNlbmxu5n
testing/webdriver/src/response.rs
--- a/testing/webdriver/src/response.rs
+++ b/testing/webdriver/src/response.rs
@@ -21,22 +21,22 @@ pub enum WebDriverResponse {
 impl WebDriverResponse {
     pub fn to_json_string(self) -> String {
         use response::WebDriverResponse::*;
 
         let obj = match self {
             CloseWindow(ref x) => json::encode(&x.to_json()),
             Cookie(ref x) => json::encode(x),
             Cookies(ref x) => json::encode(x),
-            DeleteSession => Ok("{}".to_string()),
+            DeleteSession => Ok("null".to_string()),
             ElementRect(ref x) => json::encode(x),
             Generic(ref x) => json::encode(x),
             NewSession(ref x) => json::encode(x),
             Timeouts(ref x) => json::encode(x),
-            Void => Ok("{}".to_string()),
+            Void => Ok("null".to_string()),
             WindowRect(ref x) => json::encode(&x.to_json()),
         }.unwrap();
 
         match self {
             Generic(_) | Cookie(_) | Cookies(_) => obj,
             _ => {
                 let mut data = String::with_capacity(11 + obj.len());
                 data.push_str("{\"value\": ");