Updated followRedirect to support function as a value. Added unit tests