test beforeHandle