Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions client/src/cbltest/api/replicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ async def start(self) -> None:
payload.pinnedServerCert = self.pinned_server_cert
payload.reset = self.reset
payload.collections = self.collections
payload.headers = self.headers
req = self.__request_factory.create_request(
TestServerRequestType.START_REPLICATOR, payload
)
Expand Down
4 changes: 4 additions & 0 deletions client/src/cbltest/v1/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,9 @@ def __init__(self, database: str, endpoint: str):
self.pinnedServerCert: str | None = None
"""The PEM representation of the TLS certificate that the remote is using"""

self.headers: dict[str, str] | None = None
"""The headers to include in the replication requests"""

def to_json(self) -> Any:
"""Serializes the :class:`PostStartReplicatorRequestBody` to a JSON string"""
raw = {
Expand All @@ -469,6 +472,7 @@ def to_json(self) -> Any:
"enableDocumentListener": self.enableDocumentListener,
"enableAutoPurge": self.enableAutoPurge,
"pinnedServerCert": self.pinnedServerCert,
"headers": self.headers,
}

if self.collections is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,14 @@ internal readonly record struct StartReplicatorConfig
public bool enableAutoPurge { get; init; }

public string? pinnedServerCert { get; init; }

public IReadOnlyDictionary<string, string?>? headers { get; init; }

[JsonConstructor]
public StartReplicatorConfig(string database, string endpoint,
string replicatorType, bool continuous, IReadOnlyList<StartReplicatorCollection> collections,
StartReplicatorAuthenticator? authenticator = null, bool enableDocumentListener = false,
bool enableAutoPurge = true, string? pinnedServerCert = null)
bool enableAutoPurge = true, string? pinnedServerCert = null, IReadOnlyDictionary<string, string?>? headers = null)
{
this.database = database;
this.endpoint = endpoint;
Expand All @@ -277,6 +279,7 @@ public StartReplicatorConfig(string database, string endpoint,
this.enableDocumentListener = enableDocumentListener;
this.enableAutoPurge = enableAutoPurge;
this.pinnedServerCert = pinnedServerCert;
this.headers = headers;

if (replicatorType.ToLowerInvariant() == "pull") {
ReplicatorType = ReplicatorType.Pull;
Expand Down Expand Up @@ -360,7 +363,8 @@ public static Task StartReplicatorHandler(int version, Session session, JsonDocu
EnableAutoPurge = deserializedBody.config.enableAutoPurge,
PinnedServerCertificate = deserializedBody.config.pinnedServerCert != null
? new(Encoding.ASCII.GetBytes(deserializedBody.config.pinnedServerCert))
: null
: null,
Headers = deserializedBody.config.headers?.ToImmutableDictionary() ?? ImmutableDictionary<string, string?>.Empty,
};

var (repl, id) = session.ObjectManager.RegisterObject(() => new Replicator(replConfig));
Expand Down
2 changes: 1 addition & 1 deletion servers/dotnet/testserver.logic/testserver.logic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<AssemblyVersion>1.1.0</AssemblyVersion>
<AssemblyVersion>1.2.2</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading