Skip to content

[Backport serverless] Update Elastic.Transport to 0.5.2 #8406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -25,14 +25,14 @@ public ElasticsearchClientProductRegistration(Type markerType) : base(markerType

public override string ServiceIdentifier => "esv";

public override string DefaultMimeType => null; // Prevent base 'ElasticsearchProductRegistration' from sending the compatibility header
public override string? DefaultContentType => null; // Prevent base 'ElasticsearchProductRegistration' from sending the compatibility header

public override MetaHeaderProvider MetaHeaderProvider => _metaHeaderProvider;

/// <summary>
/// Elastic.Clients.Elasticsearch handles 404 in its <see cref="ElasticsearchResponse.IsValidResponse" />, we do not want the low level client throwing
/// exceptions
/// when <see cref="ITransportConfiguration.ThrowExceptions" /> is enabled for 404's. The client is in charge of
/// when <see cref="IRequestConfiguration.ThrowExceptions" /> is enabled for 404's. The client is in charge of
/// composing paths
/// so a 404 never signals a wrong URL but a missing entity.
/// </summary>
@@ -77,7 +77,7 @@ public class ApiVersionMetaHeaderProducer : MetaHeaderProducer

public override string HeaderName => "Elastic-Api-Version";

public override string ProduceHeaderValue(RequestData requestData) => _apiVersion;
public override string ProduceHeaderValue(RequestData requestData, bool isAsync) => _apiVersion;

public ApiVersionMetaHeaderProducer(VersionInfo version)
{
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
<Nullable>annotations</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Elastic.Transport" Version="0.4.26" />
<PackageReference Include="Elastic.Transport" Version="0.5.2" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Tests" Key="$(ExposedPublicKey)" />
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ public ElasticsearchClientProductRegistration(Type markerType) : base(markerType
/// <summary>
/// Elastic.Clients.Elasticsearch handles 404 in its <see cref="ElasticsearchResponse.IsValidResponse" />, we do not want the low level client throwing
/// exceptions
/// when <see cref="ITransportConfiguration.ThrowExceptions" /> is enabled for 404's. The client is in charge of
/// when <see cref="IRequestConfiguration.ThrowExceptions" /> is enabled for 404's. The client is in charge of
/// composing paths
/// so a 404 never signals a wrong URL but a missing entity.
/// </summary>
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
<Nullable>annotations</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Elastic.Transport" Version="0.4.26" />
<PackageReference Include="Elastic.Transport" Version="0.5.2" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Tests" Key="$(ExposedPublicKey)" />
20 changes: 14 additions & 6 deletions src/Elastic.Clients.Elasticsearch/_Shared/Api/BulkRequest.cs
Original file line number Diff line number Diff line change
@@ -32,13 +32,17 @@ namespace Elastic.Clients.Elasticsearch;

public partial class BulkRequest : IStreamSerializable
{
internal Request Self => this;
private static readonly IRequestConfiguration RequestConfigSingleton = new RequestConfiguration
{
Accept = "application/json",
ContentType = "application/x-ndjson"
};

public BulkOperationsCollection Operations { get; set; }
internal Request Self => this;

internal override string ContentType => "application/x-ndjson";
protected internal override IRequestConfiguration RequestConfig => RequestConfigSingleton;

internal override string Accept => "application/json";
public BulkOperationsCollection Operations { get; set; }

public void Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting = SerializationFormatting.None)
{
@@ -87,9 +91,13 @@ public async Task SerializeAsync(Stream stream, IElasticsearchClientSettings set

public sealed partial class BulkRequestDescriptor : IStreamSerializable
{
internal override string ContentType => "application/x-ndjson";
private static readonly IRequestConfiguration RequestConfigSingleton = new RequestConfiguration
{
Accept = "application/json",
ContentType = "application/x-ndjson"
};

internal override string Accept => "application/json";
protected internal override IRequestConfiguration RequestConfig => RequestConfigSingleton;

private readonly BulkOperationsCollection _operations = new();

Original file line number Diff line number Diff line change
@@ -12,18 +12,19 @@
#if ELASTICSEARCH_SERVERLESS
namespace Elastic.Clients.Elasticsearch.Serverless.Esql;
#else

namespace Elastic.Clients.Elasticsearch.Esql;
#endif

internal sealed class EsqlResponseBuilder : CustomResponseBuilder
internal sealed class EsqlResponseBuilder : TypedResponseBuilder<EsqlQueryResponse>
{
public override object DeserializeResponse(Serializer serializer, ApiCallDetails response, Stream stream)
protected override EsqlQueryResponse? Build(ApiCallDetails apiCallDetails, RequestData requestData,
Stream responseStream,
string contentType, long contentLength)
{
var bytes = stream switch
var bytes = responseStream switch
{
MemoryStream ms => ms.ToArray(),
_ => BytesFromStream(stream)
_ => BytesFromStream(responseStream)
};

return new EsqlQueryResponse { Data = bytes };
@@ -37,13 +38,14 @@ static byte[] BytesFromStream(Stream stream)
}
}

public override async Task<object> DeserializeResponseAsync(Serializer serializer, ApiCallDetails response, Stream stream,
CancellationToken ctx = new CancellationToken())
protected override async Task<EsqlQueryResponse?> BuildAsync(ApiCallDetails apiCallDetails, RequestData requestData,
Stream responseStream,
string contentType, long contentLength, CancellationToken cancellationToken = default)
{
var bytes = stream switch
var bytes = responseStream switch
{
MemoryStream ms => ms.ToArray(),
_ => await BytesFromStreamAsync(stream, ctx).ConfigureAwait(false)
_ => await BytesFromStreamAsync(responseStream, cancellationToken).ConfigureAwait(false)
};

return new EsqlQueryResponse { Data = bytes };
@@ -62,10 +64,3 @@ static async Task<byte[]> BytesFromStreamAsync(Stream stream, CancellationToken
}
}
}

public sealed partial class EsqlQueryRequestParameters
{
private static readonly EsqlResponseBuilder ResponseBuilder = new();

public EsqlQueryRequestParameters() => CustomResponseBuilder = ResponseBuilder;
}
Original file line number Diff line number Diff line change
@@ -21,7 +21,6 @@
#if ELASTICSEARCH_SERVERLESS
namespace Elastic.Clients.Elasticsearch.Serverless;
#else

namespace Elastic.Clients.Elasticsearch;
#endif

@@ -165,14 +164,12 @@ private ValueTask<TResponse> DoRequestCoreAsync<TRequest, TResponse, TRequestPar

ValueTask<TResponse> SendRequest()
{
var (resolvedUrl, _, resolvedRouteValues, postData) = PrepareRequest<TRequest, TRequestParameters>(request, forceConfiguration);
var (endpointPath, resolvedRouteValues, postData) = PrepareRequest<TRequest, TRequestParameters>(request);
var openTelemetryData = PrepareOpenTelemetryData<TRequest, TRequestParameters>(request, resolvedRouteValues);

return isAsync
? new ValueTask<TResponse>(_transport
.RequestAsync<TResponse>(request.HttpMethod, resolvedUrl, postData, request.RequestParameters, in openTelemetryData, cancellationToken))
: new ValueTask<TResponse>(_transport
.Request<TResponse>(request.HttpMethod, resolvedUrl, postData, request.RequestParameters, in openTelemetryData));
? new ValueTask<TResponse>(_transport.RequestAsync<TResponse>(endpointPath, postData, in openTelemetryData, request.RequestConfig, cancellationToken))
: new ValueTask<TResponse>(_transport.Request<TResponse>(endpointPath, postData, in openTelemetryData, request.RequestConfig));
}

async ValueTask<TResponse> SendRequestWithProductCheck()
@@ -198,73 +195,59 @@ async ValueTask<TResponse> SendRequestWithProductCheckCore()
{
// Attach product check header

var hadRequestConfig = false;
HeadersList? originalHeaders = null;

if (request.RequestParameters.RequestConfiguration is null)
request.RequestParameters.RequestConfiguration = new RequestConfiguration();
else
{
originalHeaders = request.RequestParameters.RequestConfiguration.ResponseHeadersToParse;
hadRequestConfig = true;
}

request.RequestParameters.RequestConfiguration.ResponseHeadersToParse = request.RequestParameters.RequestConfiguration.ResponseHeadersToParse.Count == 0
? new HeadersList("x-elastic-product")
: new HeadersList(request.RequestParameters.RequestConfiguration.ResponseHeadersToParse, "x-elastic-product");
// TODO: The copy constructor should accept null values
var requestConfig = (request.RequestConfig is null)
? new RequestConfiguration()
{
ResponseHeadersToParse = new HeadersList("x-elastic-product")
}
: new RequestConfiguration(request.RequestConfig)
{
ResponseHeadersToParse = (request.RequestConfig.ResponseHeadersToParse is { Count: > 0 })
? new HeadersList(request.RequestConfig.ResponseHeadersToParse, "x-elastic-product")
: new HeadersList("x-elastic-product")
};

// Send request

var (resolvedUrl, _, resolvedRouteValues, postData) = PrepareRequest<TRequest, TRequestParameters>(request, forceConfiguration);
var (endpointPath, resolvedRouteValues, postData) = PrepareRequest<TRequest, TRequestParameters>(request);
var openTelemetryData = PrepareOpenTelemetryData<TRequest, TRequestParameters>(request, resolvedRouteValues);

TResponse response;

if (isAsync)
{
response = await _transport
.RequestAsync<TResponse>(request.HttpMethod, resolvedUrl, postData, request.RequestParameters, in openTelemetryData, cancellationToken)
.RequestAsync<TResponse>(endpointPath, postData, in openTelemetryData, requestConfig, cancellationToken)
.ConfigureAwait(false);
}
else
{
response = _transport
.Request<TResponse>(request.HttpMethod, resolvedUrl, postData, request.RequestParameters, in openTelemetryData);
response = _transport.Request<TResponse>(endpointPath, postData, in openTelemetryData, requestConfig);
}

// Evaluate product check result

var hasSuccessStatusCode = response.ApiCallDetails.HttpStatusCode is >= 200 and <= 299;
if (hasSuccessStatusCode)
{
var productCheckSucceeded = response.ApiCallDetails.TryGetHeader("x-elastic-product", out var values) &&
values.FirstOrDefault(x => x.Equals("Elasticsearch", StringComparison.Ordinal)) is not null;

_productCheckStatus = productCheckSucceeded
? (int)ProductCheckStatus.Succeeded
: (int)ProductCheckStatus.Failed;

if (_productCheckStatus == (int)ProductCheckStatus.Failed)
throw new UnsupportedProductException(UnsupportedProductException.InvalidProductError);
}

if (request.RequestParameters.RequestConfiguration is null)
return response;

// Reset request configuration

if (!hadRequestConfig)
request.RequestParameters.RequestConfiguration = null;
else if (originalHeaders is { Count: > 0 })
request.RequestParameters.RequestConfiguration.ResponseHeadersToParse = originalHeaders.Value;

if (!hasSuccessStatusCode)
{
// The product check is unreliable for non success status codes.
// We have to re-try on the next request.
_productCheckStatus = (int)ProductCheckStatus.NotChecked;

return response;
}

var productCheckSucceeded = response.ApiCallDetails.TryGetHeader("x-elastic-product", out var values) &&
values.FirstOrDefault(x => x.Equals("Elasticsearch", StringComparison.Ordinal)) is not null;

_productCheckStatus = productCheckSucceeded
? (int)ProductCheckStatus.Succeeded
: (int)ProductCheckStatus.Failed;

if (_productCheckStatus == (int)ProductCheckStatus.Failed)
throw new UnsupportedProductException(UnsupportedProductException.InvalidProductError);

return response;
}
}
@@ -304,69 +287,21 @@ private static OpenTelemetryData PrepareOpenTelemetryData<TRequest, TRequestPara
return openTelemetryData;
}

private (string resolvedUrl, string urlTemplate, Dictionary<string, string>? resolvedRouteValues, PostData data) PrepareRequest<TRequest, TRequestParameters>(TRequest request,
Action<IRequestConfiguration>? forceConfiguration)
private (EndpointPath endpointPath, Dictionary<string, string>? resolvedRouteValues, PostData data) PrepareRequest<TRequest, TRequestParameters>(TRequest request)
where TRequest : Request<TRequestParameters>
where TRequestParameters : RequestParameters, new()
{
request.ThrowIfNull(nameof(request), "A request is required.");

if (forceConfiguration is not null)
ForceConfiguration(request, forceConfiguration);

if (request.ContentType is not null)
ForceContentType<TRequest, TRequestParameters>(request, request.ContentType);

if (request.Accept is not null)
ForceAccept<TRequest, TRequestParameters>(request, request.Accept);

var (resolvedUrl, urlTemplate, routeValues) = request.GetUrl(ElasticsearchClientSettings);
var (resolvedUrl, _, routeValues) = request.GetUrl(ElasticsearchClientSettings);
var pathAndQuery = request.RequestParameters.CreatePathWithQueryStrings(resolvedUrl, ElasticsearchClientSettings);

var postData =
request.HttpMethod == HttpMethod.GET ||
request.HttpMethod == HttpMethod.HEAD || !request.SupportsBody
? null
: PostData.Serializable(request);

return (resolvedUrl, urlTemplate, routeValues, postData);
}

private static void ForceConfiguration<TRequestParameters>(Request<TRequestParameters> request, Action<IRequestConfiguration> forceConfiguration)
where TRequestParameters : RequestParameters, new()
{
var configuration = request.RequestParameters.RequestConfiguration ?? new RequestConfiguration();
forceConfiguration(configuration);
request.RequestParameters.RequestConfiguration = configuration;
}

private static void ForceContentType<TRequest, TRequestParameters>(TRequest request, string contentType)
where TRequest : Request<TRequestParameters>
where TRequestParameters : RequestParameters, new()
{
var configuration = request.RequestParameters.RequestConfiguration ?? new RequestConfiguration();
configuration.Accept = contentType;
configuration.ContentType = contentType;
request.RequestParameters.RequestConfiguration = configuration;
}

private static void ForceAccept<TRequest, TRequestParameters>(TRequest request, string acceptType)
where TRequest : Request<TRequestParameters>
where TRequestParameters : RequestParameters, new()
{
var configuration = request.RequestParameters.RequestConfiguration ?? new RequestConfiguration();
configuration.Accept = acceptType;
request.RequestParameters.RequestConfiguration = configuration;
}

internal static void ForceJson(IRequestConfiguration requestConfiguration)
{
requestConfiguration.Accept = RequestData.DefaultMimeType;
requestConfiguration.ContentType = RequestData.DefaultMimeType;
}

internal static void ForceTextPlain(IRequestConfiguration requestConfiguration)
{
requestConfiguration.Accept = RequestData.MimeTypeTextPlain;
requestConfiguration.ContentType = RequestData.MimeTypeTextPlain;
return (new EndpointPath(request.HttpMethod, pathAndQuery), routeValues, postData);
}
}
Original file line number Diff line number Diff line change
@@ -10,8 +10,10 @@
using System.Reflection;

#if ELASTICSEARCH_SERVERLESS
using Elastic.Clients.Elasticsearch.Serverless.Esql;
using Elastic.Clients.Elasticsearch.Serverless.Fluent;
#else
using Elastic.Clients.Elasticsearch.Esql;
using Elastic.Clients.Elasticsearch.Fluent;
#endif

@@ -104,9 +106,9 @@ public ElasticsearchClientSettings(
/// <inheritdoc cref="IElasticsearchClientSettings" />
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public abstract class
ElasticsearchClientSettingsBase<TConnectionSettings> : ConnectionConfigurationBase<TConnectionSettings>,
IElasticsearchClientSettings
public abstract class ElasticsearchClientSettingsBase<TConnectionSettings> :
ConnectionConfigurationBase<TConnectionSettings>,
IElasticsearchClientSettings
where TConnectionSettings : ElasticsearchClientSettingsBase<TConnectionSettings>, IElasticsearchClientSettings
{
private readonly FluentDictionary<Type, string> _defaultIndices;
@@ -381,19 +383,21 @@ public ConnectionConfiguration(NodePool nodePool, IRequestInvoker requestInvoker
/// <inheritdoc cref="TransportClientConfigurationValues" />
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public abstract class
ConnectionConfigurationBase<TConnectionConfiguration> : TransportConfigurationBase<TConnectionConfiguration>,
TransportClientConfigurationValues
where TConnectionConfiguration : ConnectionConfigurationBase<TConnectionConfiguration>,
public abstract class ConnectionConfigurationBase<TConnectionConfiguration> :
TransportConfigurationDescriptorBase<TConnectionConfiguration>,
TransportClientConfigurationValues
where TConnectionConfiguration : ConnectionConfigurationBase<TConnectionConfiguration>, TransportClientConfigurationValues
{
private bool _includeServerStackTraceOnError;

protected ConnectionConfigurationBase(NodePool nodePool, IRequestInvoker requestInvoker,
Serializer? serializer,
ProductRegistration registration = null)
: base(nodePool, requestInvoker, serializer, registration ?? new ElasticsearchProductRegistration(typeof(ElasticsearchClient))) =>
UserAgent(ConnectionConfiguration.DefaultUserAgent);
: base(nodePool, requestInvoker, serializer, registration ?? new ElasticsearchProductRegistration(typeof(ElasticsearchClient)))
{
UserAgent(ConnectionConfiguration.DefaultUserAgent);
ResponseBuilder(new EsqlResponseBuilder());
}

bool TransportClientConfigurationValues.IncludeServerStackTraceOnError => _includeServerStackTraceOnError;

Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@ namespace Elastic.Clients.Elasticsearch.Requests;
public abstract class PlainRequest<TParameters> : Request<TParameters>
where TParameters : RequestParameters, new()
{
private IRequestConfiguration? _requestConfiguration; // TODO: Remove this from the request classes and add to the endpoint methods instead

// This internal ctor ensures that only types defined within the Elastic.Clients.Elasticsearch assembly can derive from this base class.
// We don't expect consumers to derive from this public base class.
internal PlainRequest() { }
@@ -75,9 +77,9 @@ public string SourceQueryString
/// Specify settings for this request alone, handy if you need a custom timeout or want to bypass sniffing, retries
/// </summary>
[JsonIgnore]
public IRequestConfiguration RequestConfiguration
public IRequestConfiguration? RequestConfiguration
{
get => RequestParameters.RequestConfiguration;
set => RequestParameters.RequestConfiguration = value;
get => _requestConfiguration;
set => _requestConfiguration = value;
}
}
20 changes: 4 additions & 16 deletions src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/Request.cs
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using Elastic.Transport;
using Elastic.Transport.Diagnostics;

#if ELASTICSEARCH_SERVERLESS
namespace Elastic.Clients.Elasticsearch.Serverless.Requests;
@@ -23,9 +22,7 @@ public abstract class Request
// We don't expect consumers to derive from this public base class.
internal Request() { }

internal virtual string? Accept { get; } = null;

internal virtual string? ContentType { get; } = null;
[JsonIgnore] protected internal virtual IRequestConfiguration? RequestConfig { get; set; }

/// <summary>
/// The default HTTP method for the request which is based on the Elasticsearch Specification endpoint definition.
@@ -68,28 +65,19 @@ internal virtual void BeforeRequest() { }
public abstract class Request<TParameters> : Request
where TParameters : RequestParameters, new()
{
private readonly TParameters _parameters;

internal Request() => _parameters = new TParameters();
internal Request() => RequestParameters = new TParameters();

protected Request(Func<RouteValues, RouteValues> pathSelector)
{
pathSelector(RouteValues);
_parameters = new TParameters();
RequestParameters = new TParameters();
}

[JsonIgnore] internal TParameters RequestParameters => _parameters;
[JsonIgnore] internal TParameters RequestParameters { get; }

protected TOut? Q<TOut>(string name) => RequestParameters.GetQueryStringValue<TOut>(name);

protected void Q(string name, object? value) => RequestParameters.SetQueryString(name, value);

protected void Q(string name, IStringable value) => RequestParameters.SetQueryString(name, value.GetString());

protected void SetAcceptHeader(string format)
{
RequestParameters.RequestConfiguration ??= new RequestConfiguration();
RequestParameters.RequestConfiguration.Accept =
RequestParameters.AcceptHeaderFromFormat(format);
}
}
Original file line number Diff line number Diff line change
@@ -22,9 +22,10 @@ namespace Elastic.Clients.Elasticsearch.Requests;
/// <summary>
/// Base class for all request descriptor types.
/// </summary>
public abstract partial class RequestDescriptor<TDescriptor, TParameters> : Request<TParameters>, ISelfSerializable
where TDescriptor : RequestDescriptor<TDescriptor, TParameters>
where TParameters : RequestParameters, new()
public abstract partial class RequestDescriptor<TDescriptor, TParameters> :
Request<TParameters>, ISelfSerializable
where TDescriptor : RequestDescriptor<TDescriptor, TParameters>
where TParameters : RequestParameters, new()
{
private readonly TDescriptor _descriptor;

@@ -56,12 +57,10 @@ protected TDescriptor Qs(string name, IStringable value)
/// <summary>
/// Specify settings for this request alone, handy if you need a custom timeout or want to bypass sniffing, retries
/// </summary>
public TDescriptor RequestConfiguration(
Func<RequestConfigurationDescriptor, IRequestConfiguration> configurationSelector)
public TDescriptor RequestConfiguration(Func<RequestConfigurationDescriptor, IRequestConfiguration> configurationSelector)
{
var rc = RequestParameters.RequestConfiguration;
RequestParameters.RequestConfiguration =
configurationSelector?.Invoke(new RequestConfigurationDescriptor(rc)) ?? rc;
var rc = RequestConfig;
RequestConfig = configurationSelector?.Invoke(new RequestConfigurationDescriptor(rc)) ?? rc;
return _descriptor;
}

Original file line number Diff line number Diff line change
@@ -124,7 +124,7 @@ private async Task<BulkAllResponse> BulkAsync(IList<T> buffer, long page, int ba

var response = await _client.BulkAsync(s =>
{
s.RequestParameters.RequestConfiguration = new RequestConfiguration { DisableAuditTrail = false };
s.RequestConfiguration(x => x.DisableAuditTrail(false));
s.Index(request.Index);
s.Timeout(request.Timeout);

This file was deleted.

2 changes: 1 addition & 1 deletion src/Playground/Playground.csproj
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="Moq" Version="4.18.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Elastic.Transport" Version="0.4.26" />
<PackageReference Include="Elastic.Transport" Version="0.5.2" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

6 changes: 3 additions & 3 deletions tests/Tests.Core/Client/FixedResponseClient.cs
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ public static ElasticsearchClient Create(
object response,
int statusCode = 200,
Func<ElasticsearchClientSettings, ElasticsearchClientSettings> modifySettings = null,
string contentType = RequestData.DefaultMimeType,
string contentType = RequestData.DefaultContentType,
Exception exception = null
)
{
@@ -29,7 +29,7 @@ public static ElasticsearchClientSettings CreateConnectionSettings(
object response,
int statusCode = 200,
Func<ElasticsearchClientSettings, ElasticsearchClientSettings> modifySettings = null,
string contentType = RequestData.DefaultMimeType,
string contentType = RequestData.DefaultContentType,
Exception exception = null,
Serializer serializer = null
)
@@ -46,7 +46,7 @@ public static ElasticsearchClientSettings CreateConnectionSettings(
break;
default:
{
responseBytes = contentType == RequestData.DefaultMimeType
responseBytes = contentType == RequestData.DefaultContentType
? serializer.SerializeToBytes(response,
TestClient.Default.ElasticsearchClientSettings.MemoryStreamFactory)
: Encoding.UTF8.GetBytes(response.ToString());
2 changes: 1 addition & 1 deletion tests/Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
<ProjectReference Include="$(SolutionRoot)\tests\Tests.Core\Tests.Core.csproj" />
<ProjectReference Include="$(SolutionRoot)\src\Elastic.Clients.Elasticsearch\Elastic.Clients.Elasticsearch.csproj" />
<ProjectReference Include="$(SolutionRoot)\tests\Tests.ClusterLauncher\Tests.ClusterLauncher.csproj" />
<PackageReference Include="Elastic.Transport.VirtualizedCluster" Version="0.4.26" />
<PackageReference Include="Elastic.Transport.VirtualizedCluster" Version="0.5.2" />
<PackageReference Include="FSharp.Core" Version="6.0.3" />
<PackageReference Include="Bogus" Version="22.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />