From a5dfae984f8e1a58d55f4811ad8d398f2954e735 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Thu, 22 Feb 2018 12:12:28 +1000 Subject: [PATCH] Ensure API key is passed via the command --- src/SeqCli/Cli/Commands/LogCommand.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/SeqCli/Cli/Commands/LogCommand.cs b/src/SeqCli/Cli/Commands/LogCommand.cs index a4e091b2..c3d34fb2 100644 --- a/src/SeqCli/Cli/Commands/LogCommand.cs +++ b/src/SeqCli/Cli/Commands/LogCommand.cs @@ -102,7 +102,13 @@ protected override async Task Run() } var connection = _connectionFactory.Connect(_connection); - var result = await connection.Client.HttpClient.PostAsync(ApiConstants.IngestionEndpoint, content); + + var request = new HttpRequestMessage(HttpMethod.Post, ApiConstants.IngestionEndpoint) {Content = content}; + + if (_connection.IsApiKeySpecified) + request.Headers.Add("X-Seq-ApiKey", _connection.ApiKey); + + var result = await connection.Client.HttpClient.SendAsync(request); if (result.IsSuccessStatusCode) return 0;