Skip to content

Unable to set message body as data-urlencode in HTTP POST #2283

Open
@darshan-pandit

Description

@darshan-pandit

Describe the bug
Unable to set message body as data-urlencode in HTTP POST

It was possible to add rest request parameter as query string or plain text body.
However, I have requirement to pass body as url encoded data, which was not possible.

To Reproduce
restRequest.AddOrUpdateHeader("Authorization", "Basic basc64encodedUsernameColonPassword");
restRequest.AddOrUpdateParameter("queryStringParameter1", "queryStringParameterValue1", ParameterType.QueryString);
restRequest.AddOrUpdateParameter("bodyContent", ParameterType.RequestBody, true);

I was able to make HTTP POST call using Postman
Curl command allows you to pass basic data using parameter --data and to pass url encoded data using parameter --data-urlencode
Postman code snipped shows use of parameter --data-urlencode

curl --location 'https://server:port/export?queryParameter1=queryParameterValue1'
--header 'Authorization: Basic basc64encodedUsernameColonPassword'
--data-urlencode 'some search query with some condition'

Expected behavior
A valid response containing json data was expected, however, I received message saying no data found or empty search.

Desktop (please complete the following information):

  • OS: Windows 10
  • .NET version .NET 8
  • Version 110.2.0

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