Ruby
Ruby
Example: Http.HasRequestHeader method
Demonstrates theHasRequestHeader method.
Chilkat Ruby Downloads
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