Lua
Lua
Example: Http.HasRequestHeader method
Demonstrates theHasRequestHeader method.
Chilkat Lua Downloads
local chilkat = require("chilkat")
local http = chilkat.Http.new()
http:set_request_header("X-CSRF-Token", "Fetch")
local b = http:has_request_header("X-CSRF-Token")
if b then
print("X-CSRF-Token: Yes")
else
print("X-CSRF-Token: No")
end
b = http:has_request_header("X-Something")
if b then
print("X-Something: Yes")
else
print("X-Something: No")
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:has_request_header("Accept")
if b then
print("Accept: Yes")
else
print("Accept: No")
end
-- Output:
-- X-CSRF-Token: Yes
-- X-Something: No
-- Accept: Yes