mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-19 23:38:36 +02:00
MINOR: lua: Make set_var() and unset_var() return success
This patch makes `set_var()` and `unset_var()` return a boolean indicating success.
This commit is contained in:
committed by
Christopher Faulet
parent
b4fac1eb3c
commit
84ebc136a1
12
reg-tests/lua/set_var.lua
Normal file
12
reg-tests/lua/set_var.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
core.register_service("set_var", "http", function(applet)
|
||||
local var_name = applet.headers["var"][0]
|
||||
local result = applet:set_var(var_name, "value")
|
||||
if result then
|
||||
applet:set_status(202)
|
||||
else
|
||||
applet:set_status(400)
|
||||
end
|
||||
applet:add_header("echo", applet:get_var(var_name) or "(nil)")
|
||||
applet:start_response()
|
||||
applet:send("")
|
||||
end)
|
||||
Reference in New Issue
Block a user