14 lines
527 B
C#
14 lines
527 B
C#
public static class GatewayAuthHelper
|
|
{
|
|
public const string DevGatewayKey = "dev-gateway-key-change-in-production";
|
|
|
|
public static void WithGatewayApiKey(
|
|
this HttpClient client, Guid gatewayId, string? apiKey = null)
|
|
{
|
|
client.DefaultRequestHeaders.Remove("X-Api-Key");
|
|
client.DefaultRequestHeaders.Remove("X-Gateway-Id");
|
|
client.DefaultRequestHeaders.Add("X-Api-Key", apiKey ?? DevGatewayKey);
|
|
client.DefaultRequestHeaders.Add("X-Gateway-Id", gatewayId.ToString());
|
|
}
|
|
}
|