Sample code for 30+ languages & platforms
Rust

Example: Http.HasRequestHeader method

Demonstrates the HasRequestHeader method.

Chilkat Rust Downloads

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

http.set_request_header("X-CSRF-Token", "Fetch");

let mut b = http.has_request_header("X-CSRF-Token");
if b {
    println!("X-CSRF-Token: Yes");
} else {
    println!("X-CSRF-Token: No");
}

b = http.has_request_header("X-Something");
if b {
    println!("X-Something: Yes");
} else {
    println!("X-Something: No");
}

// The Accept and Accept-Encoding headers are default headers automatically added,
// unless the application chooses to remove by calling RemoveRequestHeader for each.
b = http.has_request_header("Accept");
if b {
    println!("Accept: Yes");
} else {
    println!("Accept: No");
}

// Output:

// X-CSRF-Token: Yes
// X-Something: No
// Accept: Yes