Strip empty /path/arguments in modulse/rest_api.py

This commit is contained in:
jesopo 2018-10-04 17:37:03 +01:00
parent f8170d8751
commit d7f4050ae8

View file

@ -23,8 +23,10 @@ class Handler(http.server.BaseHTTPRequestHandler):
if parsed.path.startswith("/api/"):
_, _, endpoint = parsed.path[1:].partition("/")
endpoint, _, args = endpoint.partition("/")
args = list(filter(None, args.split("/")))
response = _events.on("api").on(endpoint).call_for_result(
params=get_params, path=args.split("/"))
params=get_params, path=args)
if response:
response = json.dumps(response, sort_keys=True,