diff --git a/docs/_newsfragments/1872.bugfix.rst b/docs/_newsfragments/1872.bugfix.rst index d7ec309a2..6285abfd9 100644 --- a/docs/_newsfragments/1872.bugfix.rst +++ b/docs/_newsfragments/1872.bugfix.rst @@ -1,4 +1,7 @@ :attr:`falcon.Uri.encode` and :attr:`falcon.Uri.encode_value` now escape all percent characters by default even if it appears they have already been escaped. -The ``check_is_escaped`` flag has been added to allow the option of retaining the previous -behavior of ignoring strings that look like they've already been escaped. \ No newline at end of file +The :attr:`falcon.Uri.encode_check_escaped` and :attr:`falcon.Uri.encode_value_check_escaped` +methods have been added to give the option of retaining the previous behavior where needed. +These new methods have been applied to the :attr:`falcon.Response.location`, +:attr:`falcon.Response.content_location`, :attr:`falcon.Response.append_link` +attrs and methods to retain previous behavior. \ No newline at end of file diff --git a/falcon/util/uri.py b/falcon/util/uri.py index 3b57a7d45..0ecbc8f2f 100644 --- a/falcon/util/uri.py +++ b/falcon/util/uri.py @@ -553,5 +553,5 @@ def unquote_string(quoted): 'encode_value_check_escaped', 'parse_host', 'parse_query_string', - 'unquote_string' + 'unquote_string', ] diff --git a/tests/test_utils.py b/tests/test_utils.py index bed372c6e..5871f8056 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -244,9 +244,6 @@ def test_uri_encode(self): assert uri.decode(uri.encode('%26')) == '%26' def test_uri_encode_double(self): - # NOTE(minesja): check_is_escaped added to allow option to - # retain behavior of ignoring already escaped values (#68) - url = 'http://example.com/v1/fiz bit/messages' expected = 'http://example.com/v1/fiz%20bit/messages' assert uri.encode_check_escaped(uri.encode_check_escaped(url)) == expected