Only count a None response from an API event hook to be a 404

This commit is contained in:
jesopo 2018-11-06 14:09:13 +00:00
parent 276fe2c8fa
commit f06c824ae9
2 changed files with 4 additions and 2 deletions

View file

@ -19,7 +19,7 @@ class Module(ModuleManager.BaseModule):
if not full_name in values: if not full_name in values:
hooks.pop(i) hooks.pop(i)
if not hooks: if not hooks:
return return None
github_event = event["headers"]["X-GitHub-Event"] github_event = event["headers"]["X-GitHub-Event"]
@ -47,6 +47,8 @@ class Module(ModuleManager.BaseModule):
trigger = self._make_trigger(channel, server, output) trigger = self._make_trigger(channel, server, output)
self.bot.trigger(trigger) self.bot.trigger(trigger)
return True
def _make_trigger(self, channel, server, line): def _make_trigger(self, channel, server, line):
return lambda: self.events.on("send.stdout").call( return lambda: self.events.on("send.stdout").call(
target=channel, module_name="Github", server=server, message=line) target=channel, module_name="Github", server=server, message=line)

View file

@ -35,7 +35,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
except: except:
code = 500 code = 500
if event_response: if not event_response == None:
response = json.dumps(event_response, response = json.dumps(event_response,
sort_keys=True, indent=4) sort_keys=True, indent=4)
code = 200 code = 200