From 5458c1271fc720b85f120308c931224532356cb5 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Fri, 9 Nov 2012 14:52:46 +0100 Subject: [PATCH] http: Switch to HTTP method dispatcher for /api --- mopidy/frontends/http/actor.py | 3 +++ mopidy/frontends/http/api.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mopidy/frontends/http/actor.py b/mopidy/frontends/http/actor.py index 7eed0937..8678d8b0 100644 --- a/mopidy/frontends/http/actor.py +++ b/mopidy/frontends/http/actor.py @@ -57,6 +57,9 @@ class HttpFrontend(pykka.ThreadingActor, CoreListener): 'tools.staticdir.index': 'index.html', 'tools.staticdir.dir': static_dir, }, + '/api': { + 'request.dispatch': cherrypy.dispatch.MethodDispatcher(), + }, '/ws': { 'tools.websocket.on': True, 'tools.websocket.handler_cls': ws.WebSocketHandler, diff --git a/mopidy/frontends/http/api.py b/mopidy/frontends/http/api.py index b414c60c..0003f06a 100644 --- a/mopidy/frontends/http/api.py +++ b/mopidy/frontends/http/api.py @@ -7,12 +7,13 @@ except ImportError as import_error: class ApiResource(object): + exposed = True + def __init__(self, core): self.core = core - @cherrypy.expose @cherrypy.tools.json_out() - def index(self): + def GET(self): playback_state = self.core.playback.state.get() track = self.core.playback.current_track.get() if track: