tghamm / Mistral.SDK

An unofficial C#/.NET SDK for accessing the Mistral AI API
https://www.nuget.org/packages/Mistral.SDK
MIT License
27 stars 4 forks source link

Cannot add value because header 'Authorization' does not support multiple values. #5

Open DummyAppTest opened 2 weeks ago

DummyAppTest commented 2 weeks ago

when trying to chat with multiple messages, an error occurs "Cannot add value because header 'Authorization' does not support multiple values." why?

DummyAppTest commented 2 weeks ago

EndpointBase.cs line 61 change to

if (!client.DefaultRequestHeaders.Contains("Authorization"))
    client.DefaultRequestHeaders.Add("Authorization", $"Bearer {Client.Auth.ApiKey}");
if (!client.DefaultRequestHeaders.Contains("User-Agent"))
    client.DefaultRequestHeaders.Add("User-Agent", UserAgent);