Skip to content

Adding a DefaultParameter on a RestClient and use it in a Post request doesn't work #1972

@giembultje

Description

@giembultje

Describe the bug
Adding a DefaultParameter on a RestClient and use it in a Post request doesn't work anymore in version 108.0.2. The parameter is ignored and not send in the request. This did work in version 106.

To Reproduce
Create a restclient and when created add a default parameter:

private RestClient CurrentRestClient { get; set; } = null;

CurrentRestClient = new RestClient("myrestendpoint");
CurrentRestClient.AddDefaultParameter("f", "json");

RestRequest myrequest= new RestRequest("mypath", Method.Post);
RestResponse response = CurrentRestClient.Execute(myrequest);

Response contains a HTML output because the server did not receive the f parameter.
When adding the next line, the response is correct:

myrequest.AddParameter("f", "json");

So adding the parameter on the request works fine.

Expected behavior
When adding a default parameter as get/post, the parameter should also be sent to the server in case of a post request.

Desktop (please complete the following information):

  • OS: Windows
  • .NET version 6
  • Version 108.0.2

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