branch | stable |
changeset 5513 | 07b32d9d8804 |
parent 5155 | 1dea6e0fdfc1 |
child 7855 | 54283a5b7afc |
--- a/etwist/http.py Tue May 11 16:26:29 2010 +0200 +++ b/etwist/http.py Tue May 11 16:48:26 2010 +0200 @@ -45,10 +45,11 @@ def _finalize(self): + # we must set code before writing anything, else it's too late + if self._code is not None: + self._twreq.setResponseCode(self._code) if self._stream is not None: self._twreq.write(str(self._stream)) - if self._code is not None: - self._twreq.setResponseCode(self._code) self._twreq.finish() def __repr__(self):