Revert "removed res.end"

This reverts commit ecc629646f7660f574d3b10f736b83d80c0fb7ca.