Created
May 9, 2017 00:51
-
-
Save beldpro-ci/22e0cb15d949a84936584e02c7b80139 to your computer and use it in GitHub Desktop.
Lua module to dump all request headers to the http client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Outputs the contents of the headers | |
-- in a plain text format. | |
-- Headers: | |
-- key=value | |
return function () | |
-- 'ngx.say' emits content to the HTTP client of that | |
-- request. | |
ngx.say("Headers:") | |
-- 'req.get_headers' gives us a lua table that | |
-- has all the current request headers for | |
-- the current request | |
local h = ngx.req.get_headers() | |
for k, v in pairs(h) do | |
ngx.say(string.format("\t%s=%s", k ,v)) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment