Révision 698c4ef1
Ajouté par Jérôme Schneider il y a presque 10 ans
entrouvert/djommon/middleware.py | ||
---|---|---|
7 | 7 |
|
8 | 8 |
class VersionMiddleware: |
9 | 9 |
def process_request(self, request): |
10 |
if request.method == 'GET' and request.path == '/__version__': |
|
10 |
if request.method == 'GET' and (request.path == '/__version__' or |
|
11 |
request.path == '/__version__/'): |
|
11 | 12 |
packages_version = middleware.VersionMiddleware.get_packages_version() |
12 | 13 |
return HttpResponse(json.dumps(packages_version), |
13 | 14 |
content_type='application/json') |
entrouvert/wsgi/middleware.py | ||
---|---|---|
40 | 40 |
path += quote(environ.get('SCRIPT_NAME', '')) |
41 | 41 |
path += quote(environ.get('PATH_INFO', '')) |
42 | 42 |
method = environ.get('REQUEST_METHOD', 'GET') |
43 |
if method == 'GET' and path == '/__version__': |
|
43 |
if method == 'GET' and (path == '/__version__' or |
|
44 |
path == '/__version__/'): |
|
44 | 45 |
packages_version = self.get_packages_version() |
45 | 46 |
start_response('200 Ok', [('content-type', 'application/json')]) |
46 | 47 |
return [json.dumps(packages_version)] |
Formats disponibles : Unified diff
middleware: match url /__version__ or /__version__/