Added before request function.