pub fn curl_text(url: &str) -> Result<String, Box<dyn Error + Send + Sync>>Expand description
What: Fetch plain text from a URL using curl.
Inputs:
url: URL to request
Output:
Ok(String)with response body;Errif curl or UTF-8 decoding fails
ยงErrors
- Returns
Errwhen curl command execution fails (I/O error or curl not found) - Returns
Errwhen curl exits with non-zero status (network errors, HTTP errors, timeouts) - Returns
Errwhen response body cannot be decoded as UTF-8
Details:
- Executes curl with appropriate flags and returns the raw body as a
String. - On Windows, uses
-kflag to skip SSL certificate verification. - Provides user-friendly error messages for common curl failure cases.