Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 7 additions & 10 deletions crates/opencli-rs-ai/src/cascade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,7 @@ fn build_fetch_probe_js(url: &str, credentials: bool, extract_csrf: bool) -> Str

/// Probe an endpoint with a specific strategy.
/// Returns whether the probe succeeded and basic response info.
pub async fn probe_endpoint(
page: &dyn IPage,
url: &str,
strategy: Strategy,
) -> StrategyTestResult {
pub async fn probe_endpoint(page: &dyn IPage, url: &str, strategy: Strategy) -> StrategyTestResult {
let result = match strategy {
Strategy::Public => {
// PUBLIC: plain fetch, no credentials
Expand Down Expand Up @@ -163,10 +159,7 @@ async fn eval_probe(page: &dyn IPage, js: &str, strategy: Strategy) -> StrategyT
///
/// Confidence: 1.0 for PUBLIC, 0.9 for COOKIE, 0.8 for HEADER (simpler = more confident).
/// If none works, defaults to COOKIE with 0.3 confidence.
pub async fn cascade(
page: &dyn IPage,
api_url: &str,
) -> Result<CascadeResult, CliError> {
pub async fn cascade(page: &dyn IPage, api_url: &str) -> Result<CascadeResult, CliError> {
// Don't auto-try INTERCEPT/UI -- stop at HEADER
let max_idx = CASCADE_ORDER
.iter()
Expand Down Expand Up @@ -267,7 +260,11 @@ mod tests {

#[test]
fn test_probe_js_url_escaping() {
let js = build_fetch_probe_js("https://api.example.com/data?q=hello&limit=10", false, false);
let js = build_fetch_probe_js(
"https://api.example.com/data?q=hello&limit=10",
false,
false,
);
assert!(js.contains("api.example.com"));
}

Expand Down
Loading