diff options
| author | 2018-10-04 17:37:03 +0100 | |
|---|---|---|
| committer | 2018-10-04 17:37:03 +0100 | |
| commit | d7f4050ae87b686ba57c575fb813e6264cce3873 (patch) | |
| tree | a4dede3b53be8de5ae98106663d906e74fb7cfa8 | |
| parent | Use URL path for args, not get params (diff) | |
| signature | ||
Strip empty /path/arguments in modulse/rest_api.py
| -rw-r--r-- | modules/rest_api.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/rest_api.py b/modules/rest_api.py index 2f39da78..dfdb0746 100644 --- a/modules/rest_api.py +++ b/modules/rest_api.py @@ -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, |
