Skip to content

Commit

Permalink
Fix slack plugin to respect new API body requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
TheophileDiot committed Feb 20, 2024
1 parent cf6d4a6 commit 8e276a9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions slack/slack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function slack:log(bypass_use_slack)
end
-- Compute data
local data = {}
data.content = "```Denied request for IP "
data.text = "```Denied request for IP "
.. self.ctx.bw.remote_addr
.. " (reason = "
.. reason
Expand All @@ -52,13 +52,13 @@ function slack:log(bypass_use_slack)
.. "\n"
local headers, err = ngx_req.get_headers()
if not headers then
data.content = data.content .. "error while getting headers : " .. err
data.text = data.text .. "error while getting headers : " .. err
else
for header, value in pairs(headers) do
data.content = data.content .. header .. ": " .. value .. "\n"
data.text = data.text .. header .. ": " .. value .. "\n"
end
end
data.content = data.content .. "```"
data.text = data.text .. "```"
-- Send request
local hdr
hdr, err = ngx_timer.at(0, self.send, self, data)
Expand Down Expand Up @@ -135,7 +135,7 @@ function slack:api()

-- Send test data to slack webhook
local data = {
content = "```Test message from bunkerweb```",
text = "```Test message from bunkerweb```",
}
-- Send request
local httpc
Expand Down

0 comments on commit 8e276a9

Please sign in to comment.