middleware: match url /__version__ *or* /__version__/
This commit is contained in:
parent
86a1ba9971
commit
698c4ef1d2
|
@ -7,7 +7,8 @@ from entrouvert.wsgi import middleware
|
|||
|
||||
class VersionMiddleware:
|
||||
def process_request(self, request):
|
||||
if request.method == 'GET' and request.path == '/__version__':
|
||||
if request.method == 'GET' and (request.path == '/__version__' or
|
||||
request.path == '/__version__/'):
|
||||
packages_version = middleware.VersionMiddleware.get_packages_version()
|
||||
return HttpResponse(json.dumps(packages_version),
|
||||
content_type='application/json')
|
||||
|
|
|
@ -40,7 +40,8 @@ class VersionMiddleware(object):
|
|||
path += quote(environ.get('SCRIPT_NAME', ''))
|
||||
path += quote(environ.get('PATH_INFO', ''))
|
||||
method = environ.get('REQUEST_METHOD', 'GET')
|
||||
if method == 'GET' and path == '/__version__':
|
||||
if method == 'GET' and (path == '/__version__' or
|
||||
path == '/__version__/'):
|
||||
packages_version = self.get_packages_version()
|
||||
start_response('200 Ok', [('content-type', 'application/json')])
|
||||
return [json.dumps(packages_version)]
|
||||
|
|
Reference in New Issue