MINOR: httpclient/lua: supports headers via named arguments
authorWilliam Lallemand <wlallemand@haproxy.org>
Wed, 6 Oct 2021 08:57:44 +0000 (10:57 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Wed, 6 Oct 2021 13:21:02 +0000 (15:21 +0200)
commit746e6f3f8efe5646201f8d49d833393bacbc8c02
tree57ccb3db9d420911b1a2f276d2be0b1b63d3a336
parentef574b2101458d3af6b4c1453a7b5edadf001b66
MINOR: httpclient/lua: supports headers via named arguments

Migrate the httpclient:get() method to named arguments so we can
specify optional arguments.

This allows to pass headers as an optional argument as an array.

The () in the method call must be replaced by {}:

local res = httpclient:get{url="http://127.0.0.1:9000/?s=99",
            headers= {["X-foo"]  = { "salt" }, ["X-bar"] = {"pepper" }}}
reg-tests/lua/lua_httpclient.lua
src/hlua.c