|
|
@@ -1,3 +1,4 @@
|
|
|
+import json
|
|
|
import sys
|
|
|
from http.server import HTTPServer, BaseHTTPRequestHandler
|
|
|
|
|
|
@@ -47,8 +48,10 @@ class WebhookHandler(BaseHTTPRequestHandler):
|
|
|
# Print the request body (if any)
|
|
|
content_length = self.headers.get('Content-Length')
|
|
|
if content_length is not None:
|
|
|
- body = self.rfile.read(int(content_length))
|
|
|
- print(body.decode('utf-8'))
|
|
|
+ body = self.rfile.read(int(content_length)).decode('utf-8')
|
|
|
+ if self.headers.get('Content-Type') == 'application/json':
|
|
|
+ body = json.loads(body)
|
|
|
+ print(json.dumps(body, indent=4))
|
|
|
else:
|
|
|
print('(No body)')
|
|
|
|