Skip to content

Commit

Permalink
fix: drop x prefix (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew authored Feb 5, 2025
1 parent e66372c commit 6972875
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions src/Unleash/Communication/UnleashApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,17 +270,15 @@ private void HandleMetricsSuccessResponse(HttpResponseMessage response)

private static void SetRequestHeaders(HttpRequestMessage requestMessage, UnleashApiClientRequestHeaders headers)
{
const string appNameHeader = "UNLEASH-APPNAME";
const string userAgentHeader = "User-Agent";
const string instanceIdHeader = "UNLEASH-INSTANCEID";

const string identifyConnectionHeader = "x-unleash-connection-id";
const string identifyAppNameHeader = "x-unleash-appname";
const string identifySdkHeader = "x-unleash-sdk";
const string identifyConnectionHeader = "unleash-connection-id";
const string identifyAppNameHeader = "unleash-appname";
const string identifySdkHeader = "unleash-sdk";

const string supportedSpecVersionHeader = "Unleash-Client-Spec";

requestMessage.Headers.TryAddWithoutValidation(appNameHeader, headers.AppName);
requestMessage.Headers.TryAddWithoutValidation(userAgentHeader, headers.AppName);
requestMessage.Headers.TryAddWithoutValidation(instanceIdHeader, headers.InstanceTag);
requestMessage.Headers.TryAddWithoutValidation(supportedSpecVersionHeader, headers.SupportedSpecVersion);
Expand Down
6 changes: 3 additions & 3 deletions tests/Unleash.Tests/Communication/CustomHeadersUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ public async Task IdentificationHttpHeaders()
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" })
new KeyValuePair<string, IEnumerable<string>>("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" })
new KeyValuePair<string, IEnumerable<string>>("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" })
new KeyValuePair<string, IEnumerable<string>>("unleash-sdk", new string[] { "unleash-client-mock:0.0.0" })
);
}
}
Expand Down

0 comments on commit 6972875

Please sign in to comment.