When using both headers and a body in a result, headers are written after the body.
However, headers may not be set once the entity body has started to be written. This commit introduces a test + fix.
Merge pull request #141 from hencjo/write-headers-before-body

Headers in HttpResponse could be ignored.