Fix restResponseWriter to always use correct response code