diff --git a/pygeoapi/api/__init__.py b/pygeoapi/api/__init__.py index e54b90e6a..9685053e9 100644 --- a/pygeoapi/api/__init__.py +++ b/pygeoapi/api/__init__.py @@ -1322,7 +1322,8 @@ def evaluate_limit(requested: Union[None, int], server_limits: dict, else: requested2 = get_typed_value(requested) - if not isinstance(requested2, int): + # bool is a subclass of int, but limit=true is not a valid limit + if isinstance(requested2, bool) or not isinstance(requested2, int): raise ValueError('limit value should be an integer') if requested2 <= 0: diff --git a/tests/api/test_api.py b/tests/api/test_api.py index e0dc1e547..1b07afc86 100644 --- a/tests/api/test_api.py +++ b/tests/api/test_api.py @@ -996,6 +996,10 @@ def test_evaluate_limit(): with pytest.raises(ValueError): assert evaluate_limit('-12', server, collection) == 10 + for value in ['true', 'false', True]: + with pytest.raises(ValueError, match='should be an integer'): + evaluate_limit(value, server, collection) + assert evaluate_limit('1', server, collection) == 1 collection = {}