I've just updated RestSharp from 106.5.4 to 106.6.10 on a project and it's started duplicating the Authorization header.
My code has been:
client.AddDefaultHeader("Authorization","Bearer [TOKEN]");
Since upgrading on calling
var response = client.Execute<List<Vendor>>(request)
the API endpoint is returing unauthorized error codes and apon inspection I can see two Authorization headers in the client.DefaultParameters.
client.AllowMultipleDefaultParametersWithSameName is the default, and I can confirm it is false.
updating the code to Add the Authorization header to:
while(client.DefaultParameters.Any(p=>p.Name=="Authorization"))
client.DefaultParameters.Remove(client.DefaultParameters.First(p => p.Name == "Authorization"));
client.AddDefaultHeader("Authorization", "Bearer [TOKEN]");
corrects the issue.
I was going to submit an issue on the GitHub tracker, but it suggested to discuss on this group first.
I'm happy to answer anything further on the issue.
Thanks,
Andrew