diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 44157c7..4e511e0 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -2,6 +2,12 @@ Changelog ========= +v1.2.4 (2015-05-21) +------------------- +* Don't crash when the ``query_params`` kwarg is omitted from calls to + ``send_request()``. + + v1.2.3 (2015-04-17) ------------------- * Make ``delete_all_indexes()`` work. diff --git a/pyelasticsearch/__init__.py b/pyelasticsearch/__init__.py index 7a7b606..da69515 100644 --- a/pyelasticsearch/__init__.py +++ b/pyelasticsearch/__init__.py @@ -14,7 +14,7 @@ __all__ = ['ElasticSearch', 'ElasticHttpError', 'Timeout', 'ConnectionError', 'ElasticHttpNotFoundError', 'IndexAlreadyExistsError', 'BulkError', 'InvalidJsonResponseError', 'bulk_chunks'] -__version__ = '1.2.3' +__version__ = '1.2.4' __version_info__ = tuple(__version__.split('.')) get_version = lambda: __version_info__ diff --git a/pyelasticsearch/client.py b/pyelasticsearch/client.py index 6fdc522..82d736b 100644 --- a/pyelasticsearch/client.py +++ b/pyelasticsearch/client.py @@ -234,6 +234,8 @@ def send_request(self, :arg query_params: A map of querystring param names to values or ``None`` """ + if query_params is None: + query_params = {} path = self._join_path(path_components) # We wrap to use pyelasticsearch's exception hierarchy for backward diff --git a/pyelasticsearch/tests/client_tests.py b/pyelasticsearch/tests/client_tests.py index d6e57f5..9a744ec 100644 --- a/pyelasticsearch/tests/client_tests.py +++ b/pyelasticsearch/tests/client_tests.py @@ -390,6 +390,11 @@ def test_percolate(self): result = self.conn.percolate('test-index', 'test-type', document) self.assert_result_contains(result, {'matches': []}) + def test_send_request_without_query_params(self): + """Demonstrate that omitting the query_params kwarg to send_request + doesn't try to call iteritems() on None.""" + self.conn.send_request('GET', []) + class SearchTestCase(ElasticSearchTestCase): def setUp(self):