diff --git a/mopidy/http/actor.py b/mopidy/http/actor.py index f30532c6..7f79f2bb 100644 --- a/mopidy/http/actor.py +++ b/mopidy/http/actor.py @@ -96,14 +96,14 @@ class HttpFrontend(pykka.ThreadingActor, CoreListener): result = [] for static in self.statics: result.append(( - r'/%s/(.*)' % static['name'], + r'/{}/?(.*)'.format(static['name']), handlers.StaticFileHandler, { 'path': static['path'], 'default_filename': 'index.html' } )) - logger.debug('Loaded HTTP extension: %s', static['name']) + logger.debug('Loaded static HTTP extension: %s', static['name']) return result def _publish_zeroconf(self): diff --git a/mopidy/http/handlers.py b/mopidy/http/handlers.py index 52ee7524..91cc69d9 100644 --- a/mopidy/http/handlers.py +++ b/mopidy/http/handlers.py @@ -23,7 +23,7 @@ def mopidy_app_factory(config, core): (r'/rpc', JsonRpcHandler, { 'core': core, }), - (r'/(.*)', StaticFileHandler, { + (r'/?(.*)', StaticFileHandler, { 'path': os.path.join(os.path.dirname(__file__), 'data'), 'default_filename': 'mopidy.html' }), diff --git a/tests/http/test_server.py b/tests/http/test_server.py index d9fa6e80..25373812 100644 --- a/tests/http/test_server.py +++ b/tests/http/test_server.py @@ -53,6 +53,16 @@ class HttpServerTest(tornado.testing.AsyncHTTPTestCase): response.headers['X-Mopidy-Version'], mopidy.__version__) self.assertEqual(response.headers['Cache-Control'], 'no-cache') + def test_mopidy_should_return_index_no_slash(self): + response = self.fetch('/mopidy', method='GET') + + self.assertIn( + 'Here you can see events arriving from Mopidy in real time:', + tornado.escape.to_unicode(response.body)) + self.assertEqual( + response.headers['X-Mopidy-Version'], mopidy.__version__) + self.assertEqual(response.headers['Cache-Control'], 'no-cache') + def test_should_return_js(self): response = self.fetch('/mopidy/mopidy.js', method='GET')