Sample code for 30+ languages & platforms
Rust Requires Chilkat v11.0.0+

Example: Http.HttpNoBody method

Demonstrates how to use the HttpNoBody method to send HTTP requests without a request body (e.g., GET, DELETE, HEAD) and receive the response in a Chilkat Http response object.

Chilkat Rust Downloads

Rust

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

// Send a DELETE request to https://api.example.com/users/123
let url = "https://api.example.com/users/123".to_string();
if http.http_no_body("DELETE", &url, &resp).is_err() {
    println!("{}", http.last_error_text());
    return;
}

println!("Response Status Code: {}", resp.status_code());
println!("Response body:");
println!("{}", resp.body_str());