diff --git a/luncho/server.py b/luncho/server.py index 1084878..d3752df 100644 --- a/luncho/server.py +++ b/luncho/server.py @@ -6,8 +6,6 @@ import json import hmac import datetime -from operator import itemgetter - from flask import Flask from flask import jsonify @@ -212,12 +210,16 @@ def show_api(): summary = ' '.join(line.strip() for line in summary.split('\n')) for method in rule.methods: + if method not in ['GET', 'POST', 'PUT', 'DELETE']: + # other methods are not required + continue + routes.append([ - rule.methods.upper() + ' ' + path, + method.upper() + ' ' + path, summary ]) - routes.sort(key=itemgetter(0)) + routes.sort(key=lambda url: url[0].split()[1]) return jsonify(status='OK', api=routes) diff --git a/tests/index_tests.py b/tests/index_tests.py index 5fc0f9c..c651594 100644 --- a/tests/index_tests.py +++ b/tests/index_tests.py @@ -22,7 +22,7 @@ class TestIndex(LunchoTests): self.assertJsonOk(rv) response = json.loads(rv.data) - self.assertEqual(response['api'][0][0], '/') + self.assertEqual(response['api'][0][0], 'GET /') if __name__ == '__main__': unittest.main()