Skip to content

Commit

Permalink
test: indentification headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Tymek committed Jan 29, 2025
1 parent d164ee6 commit fc6b3f4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/Unleash.Tests/Communication/CustomHeadersUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,31 @@ public async Task DynamicHttpHeaders()
}
}

[Test]
public async Task IdentificationHttpHeaders()
{
api = CreateApiClient();
var engine = new YggdrasilEngine();

var etag = "";
await api.FetchToggles(etag, CancellationToken.None);
await api.RegisterClient(new Unleash.Metrics.ClientRegistration(), CancellationToken.None);
await api.SendMetrics(engine.GetMetrics(), CancellationToken.None);

messageHandler.calls.Count.Should().Be(3);
foreach (var call in messageHandler.calls)
{
call.Headers.Should().ContainEquivalentOf(
new KeyValuePair<string, IEnumerable<string>>("x-unleash-connection-id", new string[] { "00000000-0000-4000-a000-000000000000" })
);
call.Headers.Should().ContainEquivalentOf(
new KeyValuePair<string, IEnumerable<string>>("x-unleash-appname", new string[] { "api-test-client" })
);
call.Headers.Should().ContainEquivalentOf(
new KeyValuePair<string, IEnumerable<string>>("x-unleash-sdk", new string[] { "unleash-client-mock:0.0.0" })
);
}
}

}
}

0 comments on commit fc6b3f4

Please sign in to comment.