Http.headers
The Http.headers property returns a table that contains the headers of the requests to be sent to the server (where keys and values are strings representing header names and values respectively).
Example
--! luart-extensions
import net
local client = net.Http("https://httpbin.org")
-- add header "Content-Type" with the value "text/plain" for next requests
client.headers["Content-Type"] = "text/plain"
-- the data to be posted (in text/plain format)
local data = [[Hello World !]]
-- make a POST request, and after its terminated, call the provided function, to process the response
client:post("/post", data).after = function (self, response)
if not response then
error(net.error)
end
print(response.content)
end
waitall()