Skip to content

Commit 4ba6c90

Browse files
darootbrian-brazil
authored andcommitted
PEP333 does not require QUERY_STRING to be present. (prometheus#252)
Ensure that if a WSGI server does not provide the QUERY_STRING in the environ, that we don't throw an exception and cause a 500 to be returned to the scraping client.
1 parent c59f436 commit 4ba6c90

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

prometheus_client/exposition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
def make_wsgi_app(registry=core.REGISTRY):
3535
'''Create a WSGI app which serves the metrics from a registry.'''
3636
def prometheus_app(environ, start_response):
37-
params = parse_qs(environ['QUERY_STRING'])
37+
params = parse_qs(environ.get('QUERY_STRING', ''))
3838
r = registry
3939
if 'name[]' in params:
4040
r = r.restricted_registry(params['name[]'])

0 commit comments

Comments
 (0)