MINOR: httpclient/lua: support more HTTP methods

Add support for HEAD/PUT/POST/DELETE method with the lua httpclient.

This patch use the httpclient_req_gen() function with a different meth
parameter to implement this.

Also change the reg-test to support a POST request with a body.
This commit is contained in:
William Lallemand
2021-10-26 11:43:26 +02:00
parent dec25c3e14
commit dc2cc9008b
2 changed files with 70 additions and 10 deletions

View File

@@ -20,8 +20,14 @@ local function cron()
end
core.Debug('CRON port:' .. vtc_port)
local body = ""
for i = 0, 200 do
body = body .. i .. ' ABCDEFGHIJKLMNOPQRSTUVWXYZ\n'
end
local httpclient = core.httpclient()
local response = httpclient:get{url="http://127.0.0.1:" .. vtc_port, body="foobar-is-the-new-toto"}
local response = httpclient:post{url="http://127.0.0.1:" .. vtc_port, body=body}
core.Info("Received: " .. response.body)
end