Repository: theelous3/asks

Issue:
`request_object.RequestProcessor._dict_to_query` skips dict values evaluating to `False`
Test case:
```python
response = await asks.get('https://httpbin.org/get', params={
    'foo': 'bar',
    'zero': 0,
    'empty': '',
    'false': False
})

payload = response.json()

assert 'foo' in payload['args']  # OK
assert 'zero' in payload['args']  # Fail
assert 'empty' in payload['args']  # Fail
assert 'false' in payload['args']  # Fail
```

Erroneous code:
https://github.com/theelous3/asks/blob/733f277b7fa84e17afb4d8c3b0895bec7efb8ab4/asks/request_object.py#L442-L443


Discussion:

Patch:
diff --git a/asks/request_object.py b/asks/request_object.py
index b9bfd32..6c05b00 100644
--- a/asks/request_object.py
+++ b/asks/request_object.py
@@ -424,7 +424,8 @@ class RequestProcessor:
 
         return c_type, str(len(body)), body
 
-    def _dict_to_query(self, data, params=True, base_query=False):
+    @staticmethod
+    def _dict_to_query(data, params=True, base_query=False):
         '''
         Turns python dicts in to valid body-queries or queries for use directly
         in the request url. Unlike the stdlib quote() and it's variations,
@@ -439,7 +440,7 @@ class RequestProcessor:
         query = []
 
         for k, v in data.items():
-            if not v:
+            if v is None:
                 continue
             if isinstance(v, (str, Number)):
                 query.append('='.join(quote_plus(x) for x in (k, str(v))))


Test patch:
diff --git a/tests/test_request_object.py b/tests/test_request_object.py
index 0f1c989..9627a99 100644
--- a/tests/test_request_object.py
+++ b/tests/test_request_object.py
@@ -1,6 +1,7 @@
 # pylint: disable=no-member
 
 import h11
+import pytest
 
 from asks.request_object import RequestProcessor
 
@@ -32,3 +33,13 @@ def test_http1_1(monkeypatch):
 def test_http1_0(monkeypatch):
     response = _catch_response(monkeypatch, [('Connection', 'close')], b'hello')
     assert response.body == b'hello'
+
+
+@pytest.mark.parametrize(['data', 'query_str'], [
+    [{'foo': 'bar', 'spam': None}, '?foo=bar'],
+    [{'zero': 0}, '?zero=0'],
+    [{'empty': ''}, '?empty='],
+    [{'false': False}, '?false=False'],
+])
+def test_dict_to_query(data, query_str):
+    assert RequestProcessor._dict_to_query(data) == query_str