Sample code for 30+ languages & platforms
Rust

Demonstrate HttpRequest.RemoveAllParams

Demonstrates the effect of calling HttpRequest.RemoveAllParams.

Chilkat Rust Downloads

Rust
let req = chilkat::HttpRequest::new();

req.set_http_verb("POST");
req.set_path("/test123");
req.set_content_type("application/x-www-form-urlencoded");
req.add_param("paramA", "AAA");
req.add_param("paramB", "BBB");
req.add_param("paramC", "CCC");

println!("{}", req.generate_request_text().unwrap_or_default());
println!("---------------");

// Generates: 

// 	POST /test123 HTTP/1.1
// 	Content-Type: application/x-www-form-urlencoded
// 	Host: domain
// 	Content-Length: 32
// 
// 	paramA=AAA&paramB=BBB&paramC=CCC
// 

// If we call RemoveAllParams, and then add some additional params,
// then the original params are gone, and only the new params exist.
req.remove_all_params();
req.add_param("paramD", "DDD");
req.add_param("paramE", "EEE");
req.add_param("paramF", "FFF");
println!("{}", req.generate_request_text().unwrap_or_default());
println!("---------------");

// Generates:

// 	POST /test123 HTTP/1.1
// 	Content-Type: application/x-www-form-urlencoded
// 	Host: domain
// 	Content-Length: 32
// 
// 	paramD=DDD&paramE=EEE&paramF=FFF