# HG changeset patch # User Kim Alvefur # Date 1554041124 -7200 # Node ID a98a3922bc01ee4148144db1a6ac8fb0afa12d42 # Parent 5c37d759b1e247f56329ea3ac61cd21bb1817efd mod_pubsub_github: Send sensible status codes diff -r 5c37d759b1e2 -r a98a3922bc01 mod_pubsub_github/mod_pubsub_github.lua --- a/mod_pubsub_github/mod_pubsub_github.lua Sun Mar 31 04:49:56 2019 +0200 +++ b/mod_pubsub_github/mod_pubsub_github.lua Sun Mar 31 16:05:24 2019 +0200 @@ -9,12 +9,13 @@ local secret = module:get_option("github_secret"); function handle_POST(event) - local request = event.request; + local request, response = event.request, event.response; if secret and ("sha1=" .. hmac_sha1(secret, request.body, true)) ~= request.headers.x_hub_signature then return 401; end local data = json.decode(request.body); if not data then + response.status_code = 400; return "Invalid JSON. From you of all people..."; end @@ -34,6 +35,7 @@ end module:log("debug", "Handled POST: \n%s\n", tostring(request.body)); + response.status_code = 202; return "Thank you Github!"; end