comparison mod_slack_webhooks/mod_slack_webhooks.lua @ 3096:420391fd56e5

mod_slack_webhooks: Fix handling of form-urlencoded This had to be incorrect as there can’t be nested keys in urlencoded form data and the return value is treated as a table later
author Kim Alvefur <zash@zash.se>
date Sun, 03 Jun 2018 01:31:40 +0200
parents 3a6a48b83b4f
children c7f4e3987ed0
comparison
equal deleted inserted replaced
3095:3a6a48b83b4f 3096:420391fd56e5
93 local headers = request.headers; 93 local headers = request.headers;
94 94
95 local body_type = headers.content_type; 95 local body_type = headers.content_type;
96 local post_body; 96 local post_body;
97 if body_type == "application/x-www-form-urlencoded" then 97 if body_type == "application/x-www-form-urlencoded" then
98 post_body = formdecode(request.body)["payload"]; 98 post_body = formdecode(request.body);
99 elseif body_type == "application/json" then 99 elseif body_type == "application/json" then
100 if not pcall(function() post_body = json.decode(request.body) end) then 100 if not pcall(function() post_body = json.decode(request.body) end) then
101 return 420; 101 return 420;
102 end 102 end
103 else 103 else