changeset 3263:a65f4297264b

mod_pubsub_github: Unpack request from event
author Kim Alvefur <zash@zash.se>
date Fri, 24 Aug 2018 17:46:47 +0200
parents 0ccdd3f31435
children f48bedd1d433
files mod_pubsub_github/mod_pubsub_github.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pubsub_github/mod_pubsub_github.lua	Fri Aug 24 19:45:11 2018 +0200
+++ b/mod_pubsub_github/mod_pubsub_github.lua	Fri Aug 24 17:46:47 2018 +0200
@@ -8,7 +8,8 @@
 local node = module:get_option("github_node", "github");
 
 function handle_POST(event)
-	local data = json.decode(event.request.body);
+	local request = event.request;
+	local data = json.decode(request.body);
 	if not data then
 		return "Invalid JSON. From you of all people...";
 	end
@@ -28,7 +29,7 @@
 		);
 	end
 
-	module:log("debug", "Handled POST: \n%s\n", tostring(event.request.body));
+	module:log("debug", "Handled POST: \n%s\n", tostring(request.body));
 	return "Thank you Github!";
 end