diff options
-rw-r--r-- | cherrypy/_cprequest.py | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/cherrypy/_cprequest.py b/cherrypy/_cprequest.py index bde09891..739ad2e8 100644 --- a/cherrypy/_cprequest.py +++ b/cherrypy/_cprequest.py @@ -868,19 +868,9 @@ class Response(object): def collapse_body(self): """Collapse self.body to a single string; replace it and return it.""" - if isinstance(self.body, text_or_bytes): - return self.body - - newbody = [] - for chunk in self.body: - if six.PY3 and not isinstance(chunk, bytes): - raise TypeError("Chunk %s is not of type 'bytes'." % - repr(chunk)) - newbody.append(chunk) - newbody = b''.join(newbody) - - self.body = newbody - return newbody + new_body = b''.join(self.body) + self.body = new_body + return new_body def _flush_body(self): """ |