Skip to content

Error-body read failures are silently discarded in QueryHttpClient #87

Description

@grokspice

QueryHttpClient reads a non-2xx response's plain-text body with response.text().await.unwrap_or_default() in six places in src/query.rs (submit, status, results, cancel, and the other HttpRequestFailed arms). When the body read itself fails — connection dropped mid-body, truncated response — the error is discarded and the caller sees an error whose response_body is empty, as if the runtime had returned no explanation. The underlying transport failure is lost.

search() was brought in line in #84:

let response_body = match response.text().await {
    Ok(body) => body.trim().to_string(),
    Err(e) => format!("<error body could not be read: {e}>"),
};

The remaining six call sites still use unwrap_or_default(). They should use the same shape — most likely factored into one helper on QueryHttpClient so a future call site cannot miss it, mirroring how redirect::credentialed_client_builder centralises the redirect policy.

Raised by review feedback on #84; deferred there because changing the other six sites is outside that PR's scope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions