fix: correct misleading output for cookies clear and tab close (#556) (#563)

Bug 1: `cookies clear` printed 'Request log cleared' instead of 'Cookies cleared'
because the output handler matched the generic `{ cleared: true }` response shape
without checking the action context. Now uses the `action` parameter to distinguish
`cookies_clear` from `requests --clear`.

Bug 2: `tab close` printed 'Browser closed' instead of 'Tab closed' because the
output handler matched the generic `{ closed: ... }` response shape without checking
the action context. Now uses the `action` parameter to distinguish `tab_close` from
`close` (full browser close).

Closes #556
This commit is contained in:
Giulio Leone
2026-03-01 12:23:23 -06:00
committed by GitHub
parent e912f541f2
commit b304a4188c
+12 -4
View File
@@ -318,10 +318,14 @@ pub fn print_response_with_opts(resp: &Response, action: Option<&str>, opts: &Ou
}
return;
}
// Cleared requests
// Cleared (cookies or request log)
if let Some(cleared) = data.get("cleared").and_then(|v| v.as_bool()) {
if cleared {
println!("{} Request log cleared", color::success_indicator());
let label = match action {
Some("cookies_clear") => "Cookies cleared",
_ => "Request log cleared",
};
println!("{} {}", color::success_indicator(), label);
return;
}
}
@@ -382,9 +386,13 @@ pub fn print_response_with_opts(resp: &Response, action: Option<&str>, opts: &Ou
}
return;
}
// Closed
// Closed (browser or tab)
if data.get("closed").is_some() {
println!("{} Browser closed", color::success_indicator());
let label = match action {
Some("tab_close") => "Tab closed",
_ => "Browser closed",
};
println!("{} {}", color::success_indicator(), label);
return;
}
// Recording start (has "started" field)