Closed
Description
Hi
Upgraded a little internal tool which uses restsharp to use version 111.3.0 instead 110.2.0 and started to get the following error :
A default parameters with the same name has already been added
After quick check i found that the following code is the problem
var cli = new RestClient();
cli.AddDefaultHeader("User-Agent", "myagent");
return cli;
AddDefaultHeader throws the exception and changing the code to :
var cli = new RestClient();
cli.DefaultParameters.RemoveParameter("User-Agent", ParameterType.HttpHeader);
cli.AddDefaultHeader("User-Agent", "myAgent");
return cli;
Workarounds this problem.
Is this behavior is by design ?