Exemple #1
0
        public void Should_make_use_of_index_type_name_if_provided()
        {
            var indexTypeName = "my-type-name";
            var rollingIndexNameDateFormat = "yyyy-MM-dd";

            Uri.Init(rollingIndexNameDateFormat, indexTypeName);

            var connectionString = ";Server=127.0.0.1;Index=log_test;Port=9200;rolling=true";

            var uriBuilder = Uri.For(connectionString);
            var uri        = uriBuilder;

            var request = HttpClient.RequestFor(uri);

            request.Address.ToString().Should().Contain(indexTypeName);
        }
Exemple #2
0
        public void When_a_user_or_password_have_special_characters_it_should_still_work()
        {
            const string user     = "******";
            const string password = "******";

            const string encodedUser = "******";
            const string encodedPass = "******";

            var connectionString = $"User={user};Pwd={password};Server=127.0.0.1;Index=log_test;Port=9200;rolling=false";

            var uriBuilder = Uri.For(connectionString);
            var uri        = uriBuilder;

            var request = HttpClient.RequestFor(uri);

            request.Address.ToString().Should().ContainEquivalentOf(encodedUser);
            request.Address.ToString().Should().ContainEquivalentOf(encodedPass);

            var header = request.Headers["Authorization"];

            header.Should().Be("Basic IUAjPD4sLi9cfCQlPyYqKCk6IUAjJCU9XiYqPSgpX3t9Oj4/Pjw=");
        }
 Repository(Uri uri, IHttpClient httpClient)
 {
     this.uri = uri;
     this.httpClient = httpClient;
 }