GitHub: Reply more nicely to POST requests.

master
Valentin Lorentz 2013-03-27 15:44:47 +00:00
parent 0f19d6126d
commit 21639e4fd0
1 changed files with 8 additions and 0 deletions

View File

@ -74,7 +74,15 @@ class GithubCallback(httpserver.SupyHTTPServerCallback):
not handler.address_string() == 'localhost':
log.warning("""'%s' tried to act as a web hook for Github,
but is not GitHub.""" % handler.address_string())
self.send_response(403)
self.send_header('Content-type', 'text/plain')
self.end_headers()
self.wfile.write('Error: you are not a GitHub server.')
else:
self.send_response(200)
self.send_header('Content-type', 'text/plain')
self.end_headers()
self.wfile.write('Thanks.')
self.plugin.announce.onPayload(json.loads(form['payload'].value))
#####################