diff --git a/src/Elastic.Transport/Components/Pipeline/RequestData.cs b/src/Elastic.Transport/Components/Pipeline/RequestData.cs
index 811e8d6..f8617cc 100644
--- a/src/Elastic.Transport/Components/Pipeline/RequestData.cs
+++ b/src/Elastic.Transport/Components/Pipeline/RequestData.cs
@@ -33,10 +33,16 @@ namespace Elastic.Transport;
///
public record Endpoint(in EndpointPath Path, Node Node)
{
- ///
- /// The for the request.
- ///
- public Uri Uri { get; } = new(Node.Uri, Path.PathAndQuery);
+ /// Represents an empty endpoint used as a default or placeholder instance of .
+ public static Endpoint Empty(in EndpointPath path) => new(path, EmptyNode);
+
+ private static readonly Node EmptyNode = new(new Uri("http://empty.example"));
+
+ /// Indicates whether the endpoint is an empty placeholder instance.
+ public bool IsEmpty => Node == EmptyNode;
+
+ /// The for the request.
+ public Uri Uri { get; private init; } = new(Node.Uri, Path.PathAndQuery);
/// The HTTP method used for the request (e.g., GET, POST, PUT, DELETE, HEAD).
public HttpMethod Method => Path.Method;
@@ -44,13 +50,22 @@ public record Endpoint(in EndpointPath Path, Node Node)
/// Gets the path and query of the endpoint.
public string PathAndQuery => Path.PathAndQuery;
- /// Represents an empty endpoint used as a default or placeholder instance of .
- public static Endpoint Empty(in EndpointPath path) => new(path, EmptyNode);
-
- private static readonly Node EmptyNode = new(new Uri("http://empty.example"));
+ private readonly Node _node = Node;
- /// Indicates whether the endpoint is an empty placeholder instance.
- public bool IsEmpty => Node == EmptyNode;
+ ///
+ /// Represents a node within the transport layer of the Elastic search client.
+ /// This object encapsulates the characteristics of a node, allowing for comparisons and operations
+ /// within the broader search infrastructure.
+ ///
+ public Node Node
+ {
+ get => _node;
+ init
+ {
+ _node = value;
+ Uri = new(Node.Uri, Path.PathAndQuery);
+ }
+ }
///
public override string ToString() => $"{Path.Method.GetStringValue()} {Uri}";
diff --git a/src/Elastic.Transport/Configuration/HeadersList.cs b/src/Elastic.Transport/Configuration/HeadersList.cs
index 4cfbd41..da0a03b 100644
--- a/src/Elastic.Transport/Configuration/HeadersList.cs
+++ b/src/Elastic.Transport/Configuration/HeadersList.cs
@@ -82,8 +82,9 @@ private void AddToHeaders(HeadersList? headers)
///
public int Count => _headers.Count;
+ // ReSharper disable once ConstantConditionalAccessQualifier
///
- public IEnumerator GetEnumerator() => _headers.GetEnumerator();
+ public IEnumerator GetEnumerator() => _headers?.GetEnumerator() ?? Enumerable.Empty().GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();