Skip to content

Commit d53e765

Browse files
authored
Merge pull request #41 from The-Standard-Organization/users/cjdutoit/coderub-brokers-peerllm
CODE RUB: Change to add ApiKey as X-API-Key header
2 parents 4bc4d5a + 7fb9f4e commit d53e765

7 files changed

Lines changed: 9 additions & 11 deletions

File tree

Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.EndChat.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public async Task ShouldEndChatAsync()
2525
Request.Create()
2626
.UsingPost()
2727
.WithPath("/api/chats/end")
28-
.WithHeader("Authorization", $"Bearer {this.apiKey}")
28+
.WithHeader("X-API-Key", this.apiKey)
2929
.WithHeader("Content-Type", "application/json; charset=utf-8")
3030
.WithBody(expectedBody)
3131
)

Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.StartChat.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public async Task ShouldStartChatAsync()
3131
Request.Create()
3232
.UsingPost()
3333
.WithPath("/api/chats/start")
34-
.WithHeader("Authorization", $"Bearer {this.apiKey}")
34+
.WithHeader("X-API-Key", this.apiKey)
3535
.WithHeader("Content-Type", "application/json; charset=utf-8")
3636
.WithBody(expectedBody))
3737
.RespondWith(

Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.StreamChat.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public async Task ShouldStreamChatAsync()
3030
Request.Create()
3131
.UsingPost()
3232
.WithPath("/api/chats/stream")
33-
.WithHeader("Authorization", $"Bearer {this.apiKey}")
33+
.WithHeader("X-API-Key", this.apiKey)
3434
.WithHeader("Content-Type", "application/json; charset=utf-8")
3535
.WithBody(expectedBody))
3636
.RespondWith(

Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.EndChat.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public async Task ShouldEndChatAsync()
2525
Request.Create()
2626
.UsingPost()
2727
.WithPath("/api/v2/chats/end")
28-
.WithHeader("Authorization", $"Bearer {this.apiKey}")
28+
.WithHeader("X-API-Key", this.apiKey)
2929
.WithHeader("Content-Type", "application/json; charset=utf-8")
3030
.WithBody(expectedBody)
3131
)

Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.StartChat.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public async Task ShouldStartChatAsync()
3737
Request.Create()
3838
.UsingPost()
3939
.WithPath("/api/v2/chats/start")
40-
.WithHeader("Authorization", $"Bearer {this.apiKey}")
40+
.WithHeader("X-API-Key", this.apiKey)
4141
.WithHeader("Content-Type", "application/json; charset=utf-8")
4242
.WithBody(expectedBody))
4343
.RespondWith(

Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.StreamChat.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public async Task ShouldStreamChatAsync()
3030
Request.Create()
3131
.UsingPost()
3232
.WithPath("/api/v2/chats/stream")
33-
.WithHeader("Authorization", $"Bearer {this.apiKey}")
33+
.WithHeader("X-API-Key", this.apiKey)
3434
.WithHeader("Content-Type", "application/json; charset=utf-8")
3535
.WithBody(expectedBody))
3636
.RespondWith(

Standard.AI.PeerLLM/Brokers/PeerLLMs/PeerLLMBroker.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System;
66
using System.Collections.Generic;
77
using System.Net.Http;
8-
using System.Net.Http.Headers;
98
using System.Runtime.CompilerServices;
109
using System.Text;
1110
using System.Text.Json;
@@ -106,10 +105,9 @@ private HttpClient SetupHttpClient()
106105

107106
if (!string.IsNullOrWhiteSpace(this.peerLLMConfiguration.ApiKey))
108107
{
109-
httpClient.DefaultRequestHeaders.Authorization =
110-
new AuthenticationHeaderValue(
111-
scheme: "Bearer",
112-
parameter: this.peerLLMConfiguration.ApiKey);
108+
httpClient.DefaultRequestHeaders.Add(
109+
name: "X-API-Key",
110+
value: this.peerLLMConfiguration.ApiKey);
113111
}
114112

115113
return httpClient;

0 commit comments

Comments
 (0)