aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2018-12-06 12:00:45 +0000
committerGravatar jesopo2018-12-06 12:00:45 +0000
commite6b0d4d167d4cec7b4c045270e56314355649a64 (patch)
treebdff1df943b22ebe4ca95babcc0f89a3f15f1dfe /modules
parentAdd `returns` type hint in EventManager.py.call (diff)
signature
.title() all header keys (rest_api.py)
Diffstat (limited to 'modules')
-rw-r--r--modules/rest_api.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/rest_api.py b/modules/rest_api.py
index 74575ff4..ca1ee79f 100644
--- a/modules/rest_api.py
+++ b/modules/rest_api.py
@@ -14,6 +14,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
_, _, endpoint = path[1:].partition("/")
endpoint, _, args = endpoint.partition("/")
args = list(filter(None, args.split("/")))
+ headers = {key.title(): value for key, value in self.headers}
response = ""
code = 404
@@ -33,7 +34,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
event_response = _bot.trigger(lambda:
_events.on("api").on(method).on(
endpoint).call_unsafe_for_result(params=params,
- path=args, data=data, headers=dict(self.headers)))
+ path=args, data=data, headers=headers))
except Exception as e:
_log.error("failed to call API endpoint \"%s\"",
[path], exc_info=True)