Executing post hook before writing response header