diff options
author | Tim Burke <tim.burke@gmail.com> | 2015-05-18 08:05:02 -0700 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2015-09-03 13:46:03 -0700 |
commit | ce569f46517e10f2ce0d27e9ee0a922ad1d84e2f (patch) | |
tree | 1a32030d29466ae4d63345d26a135abde1b12fea /tests/unit/utils.py | |
parent | ff073ab34a10230cc78a4daa3cab2e22bf1fd17d (diff) | |
download | python-swiftclient-ce569f46517e10f2ce0d27e9ee0a922ad1d84e2f.tar.gz |
Centralize header parsing
All response headers are now exposed as unicode objects. Any
url-encoding is interpretted as UTF-8; if that causes decoding to fail,
the url-encoded form is returned.
As a result, deleting DLOs with unicode characters will no longer raise
UnicodeEncodeErrors under Python 2.
Related-Bug: #1431866
Change-Id: Idb111c5bf3ac1f5ccfa724b3f4ede8f37d5bfac4
Diffstat (limited to 'tests/unit/utils.py')
-rw-r--r-- | tests/unit/utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/unit/utils.py b/tests/unit/utils.py index ac9aefd..a9759eb 100644 --- a/tests/unit/utils.py +++ b/tests/unit/utils.py @@ -124,7 +124,7 @@ def fake_http_connect(*code_iter, **kwargs): def getheaders(self): if self.headers: return self.headers.items() - headers = {'content-length': len(self.body), + headers = {'content-length': str(len(self.body)), 'content-type': 'x-application/test', 'x-timestamp': self.timestamp, 'last-modified': self.timestamp, @@ -132,7 +132,7 @@ def fake_http_connect(*code_iter, **kwargs): 'etag': self.etag or '"%s"' % EMPTY_ETAG, 'x-works': 'yes', - 'x-account-container-count': 12345} + 'x-account-container-count': '12345'} if not self.timestamp: del headers['x-timestamp'] try: |