Sample code for 30+ languages & platforms
Ruby

Example: Http.HasRequestHeader method

Demonstrates the HasRequestHeader method.

Chilkat Ruby Downloads

Ruby
require 'chilkat'

http = Chilkat::CkHttp.new()

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

b = http.HasRequestHeader("X-CSRF-Token")
if (b == true)
    print "X-CSRF-Token: Yes" + "\n";
else
    print "X-CSRF-Token: No" + "\n";
end

b = http.HasRequestHeader("X-Something")
if (b == true)
    print "X-Something: Yes" + "\n";
else
    print "X-Something: No" + "\n";
end

# 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)
    print "Accept: Yes" + "\n";
else
    print "Accept: No" + "\n";
end

# Output:

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