Skip to content

Unexpected behavoir when upgrading to 111.3.0 #2235

Closed
@hagaygo

Description

@hagaygo

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions