From 832d1291055bd800fc85223b0fb5f8f73159c871 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 17 Aug 2018 20:35:34 +0100 Subject: [PATCH] [Minor] Add request header selector --- lualib/lua_selectors.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lualib/lua_selectors.lua b/lualib/lua_selectors.lua index 4d0e7a2ecc..78888de76b 100644 --- a/lualib/lua_selectors.lua +++ b/lualib/lua_selectors.lua @@ -197,6 +197,18 @@ local selectors = { ['get_value'] = function(task, _, args) return task:get_mempool():get_variable(args[1], args[2]) end, + }, + -- Get specific HTTP request header. The first argument must be header name. + ['request_header'] = { + ['type'] = 'string', + ['get_value'] = function(task, _, args) + local hdr = task:get_request_header(args[1]) + if hdr then + return tostring(hdr) + end + + return nil + end } } -- 2.47.3