Commit 18d5b053 authored by Vangelis Koukis's avatar Vangelis Koukis

Revert "Escape control characters in HTTP body, when json"

This reverts commit 556d5f15.
For more information, please see the discussion on Issue #32.
parent 1accf2cb
......@@ -351,11 +351,7 @@ class ResponseManager(Logged):
"""
self._get_response()
try:
# Ensure there are no line breaks in json string
results_in_dict = loads(self._content)
results_in_str = dumps(results_in_dict)
# Escape control characters and parse to python object
return loads(results_in_str.encode('unicode_escape'))
return loads(self._content)
except ValueError as err:
raise ClientError('Response not formated in JSON - %s' % err)
......
......@@ -205,14 +205,6 @@ class ResponseManager(TestCase):
self.assertEqual(self.RM.json, FakeResp.HEADERS)
self.assertTrue(isinstance(perform.call_args[0][0], self.HTTPC))
# Check if some control characters are escaped
sample = dict(k1='Do not \b\b\b\b\b\b\bescape this', k2='Escape \nit')
exp = dict(
k1='Do not \\b\\b\\b\\b\\b\\b\\bescape this', k2='Escape \\nit')
FakeResp.READ = dumps(sample)
self.RM._request_performed = False
self.assertEqual(self.RM.json, exp)
@patch('kamaki.clients.RequestManager.perform', return_value=FakeResp())
def test_all(self, perform):
self.assertEqual(self.RM.content, FakeResp.READ)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment