Sample code for 30+ languages & platforms
Rust

Example: Http.QuickGetSb method

Demonstrates the QuickGetSb method.

Chilkat Rust Downloads

Rust

let http = chilkat::Http::new();

// Send the HTTP GET and return the content in a StringBuilder
let sb = chilkat::StringBuilder::new();
let _ = http.quick_get_sb("https://www.chilkatsoft.com/helloWorld.json", &sb).is_ok();
if !http.last_method_success() {
    if http.last_status() == 0 {
        // Communications error.  We did not get a response.
        println!("{}", http.last_error_text());
    } else {
        println!("Response status code: {}", http.last_status());
        println!("Response body error text:");
        println!("{}", sb.get_as_string().unwrap_or_default());
    }

    return;
}

// The downloaded content:
println!("{}", sb.get_as_string().unwrap_or_default());
println!("Success");