moving content serialization from server response to response writer