Sample code for 30+ languages & platforms
Rust

HTTP DELETE with Body

See more HTTP Examples

Demonstrates how to send a DELETE request with a body.

Chilkat Rust Downloads

Rust

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

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

// Use the HttpStr method (or HttpSb) to send a DELETE request with a body.
let request_body = "{ \"abc\": 123 }".to_string();
let resp = chilkat::HttpResponse::new();
if http.http_str("DELETE", "https://example.com/something", &request_body, "utf-8", "application/json", &resp).is_err() {
    println!("{}", http.last_error_text());
    return;
}

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