diff --git a/httpretty/core.py b/httpretty/core.py index b2c5778..df6b15b 100644 --- a/httpretty/core.py +++ b/httpretty/core.py @@ -363,10 +363,10 @@ class fakesock(object): if not is_parsing_headers: if len(self._sent_data) > 1: headers = utf8(last_requestline(self._sent_data)) - meta = dict(self._entry.request.headers) + meta = self._entry.request.headers body = utf8(self._sent_data[-1]) if meta.get('transfer-encoding', '') == 'chunked': - if not body.isdigit() and body != '\r\n' and body != '0\r\n\r\n': + if not body.isdigit() and body != b'\r\n' and body != b'0\r\n\r\n': self._entry.request.body += body else: self._entry.request.body += body diff --git a/tests/functional/test_requests.py b/tests/functional/test_requests.py index 50027c9..daada92 100644 --- a/tests/functional/test_requests.py +++ b/tests/functional/test_requests.py @@ -575,7 +575,7 @@ def test_httpretty_should_allow_registering_regexes_with_streaming_responses(): os.environ['DEBUG'] = 'true' def my_callback(request, url, headers): - request.body.should.equal('hithere') + request.body.should.equal(b'hithere') return 200, headers, "Received" HTTPretty.register_uri( @@ -592,7 +592,7 @@ def test_httpretty_should_allow_registering_regexes_with_streaming_responses(): 'https://api.yipit.com/v1/deal;brand=gap?first_name=chuck&last_name=norris', data=gen(), ) - expect(response.content).to.equal("Received") + expect(response.content).to.equal(b"Received") expect(HTTPretty.last_request.method).to.equal('POST') expect(HTTPretty.last_request.path).to.equal('/v1/deal;brand=gap?first_name=chuck&last_name=norris')