Sample code for 30+ languages & platforms
C#

Example: Http.HasRequestHeader method

Demonstrates the HasRequestHeader method.

Chilkat C# Downloads

C#
Chilkat.Http http = new Chilkat.Http();

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

bool b = http.HasRequestHeader("X-CSRF-Token");
if (b == true) {
    Debug.WriteLine("X-CSRF-Token: Yes");
}
else {
    Debug.WriteLine("X-CSRF-Token: No");
}

b = http.HasRequestHeader("X-Something");
if (b == true) {
    Debug.WriteLine("X-Something: Yes");
}
else {
    Debug.WriteLine("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.HasRequestHeader("Accept");
if (b == true) {
    Debug.WriteLine("Accept: Yes");
}
else {
    Debug.WriteLine("Accept: No");
}

//  Output:

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