Skip to content

Commit

Permalink
Keep blank values query string values on request history
Browse files Browse the repository at this point in the history
We've already added empty query string matching to the matcher logic, we
should also use this when looking at request history.

Related: #101
  • Loading branch information
Jamie Lennox authored and jamielennox committed Sep 1, 2019
1 parent 1e2d090 commit c1457d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion requests_mock/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def query(self):
@property
def qs(self):
if self._qs is None:
self._qs = urlparse.parse_qs(self.query)
self._qs = urlparse.parse_qs(self.query, keep_blank_values=True)

return self._qs

Expand Down
4 changes: 4 additions & 0 deletions tests/test_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,7 @@ def test_hostname_default_port_https(self):
def test_to_string(self):
req = self.do_request(url='https://host.example.com/path')
self.assertEqual('GET https://host.example.com/path', str(req))

def test_empty_query_string(self):
req = self.do_request(url='https://host.example.com/path?key')
self.assertEqual([''], req.qs['key'])

0 comments on commit c1457d6

Please sign in to comment.