Http.cookies readwrite property
The Http.cookies property returns a table that contains the cookies of the requests to be sent to the server (where keys and values are strings
representing cookies names and values respectively).
This is a readwrite property that provides an interface over the "Cookie" field in the request headers.
Setting this property with a new table will overwrite previous "Cookie" field.
Example
local net = require "net"
local client = net.Http("https://httpbun.org")
-- Add a cookie "name" associated with the next request URI for the host "https://httpbun.org", with the value "LuaRT"
client.cookies = { name = "LuaRT" }
-- make a GET request, and after its terminated, call the provided function, to process the response
client:get("/cookies").after = function (self, response)
if not response then
error(net.error)
end
-- Should print the Cookie value
print(response.content)
end
waitall()