beforeSend hook