Skip to content

Commit

Permalink
Merge pull request #110 from rollbar/keep-blank-values
Browse files Browse the repository at this point in the history
keep blank values in request query strings
  • Loading branch information
ezarowny committed Apr 18, 2016
2 parents 9650e9b + eade19c commit d301344
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rollbar/lib/transforms/scruburl.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def redact(self, url_string):

try:
url_parts = urlsplit(url_string)
qs_params = parse_qs(url_parts.query)
qs_params = parse_qs(url_parts.query, keep_blank_values=True)
except:
# This isn't a URL, return url_string which is a no-op
# for this transform
Expand Down
7 changes: 6 additions & 1 deletion rollbar/test/test_scruburl_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _compare_urls(self, url1, url2):
url2 = '//%s' % url2

parsed_urls = map(urlparse, (url1, url2))
qs_params = map(lambda x: parse_qs(x.query), parsed_urls)
qs_params = map(lambda x: parse_qs(x.query, keep_blank_values=True), parsed_urls)
num_params = map(len, qs_params)
param_names = map(lambda x: set(x.keys()), qs_params)

Expand Down Expand Up @@ -116,6 +116,11 @@ def test_scrub_missing_scheme_and_double_slash(self):
expected = obj.replace('secr3t', '------').replace('secret', '------')
self._assertScrubbed(['password'], obj, expected)

def test_keep_blank_url_params(self):
obj = 'http://foo.com/asdf?foo=bar&baz='
expected = obj
self._assertScrubbed(['password'], obj, expected, skip_id_check=True)

def test_scrub_dict_val_isnt_string(self):

# This link will *not* be scrubbed because the value isn't a string or bytes
Expand Down

0 comments on commit d301344

Please sign in to comment.