restsharp / restsharp/RestSharp

Make parameters order in a post query configurable

Open
#2,098 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
C#
Stars
9.8k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

Hi,

has already mention in this issue #1937
I create this issue to speak about technical solution I will PR.

Is your feature request related to a problem? Please describe.

Some API require an exact order of fields in POST multipart formdata.
I the actual behavior the file is always put in first.

Describe the solution you'd like
Make fields order parametable for each request.

To do that, I plan to add in RestRequest an array of 3 Enum value (like ParameterType.File, ParameterType.Body, ParameterType.Post ) which will define the order. (Maybe the enum already exist ? I don't really search for yet )
The default order will be the actual one [File, body, post] to not break existing code.

In the RequestContent.BuildContent I will use this array to re-order call from line 46 to 53 (maybe will add headers in the list also, not sure yet)

Do you thinks this can be a good solution ? Or do you have better idea ?

Describe alternatives you've considered
No work around found

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading RestRequest and RequestContent.BuildContent, especially the parameter handling around lines 46–53, then review issue #1937 for prior context. Determine how the existing [File, body, post] order is represented and how a per-request order could preserve the current default. Done means the requested order is configurable without breaking existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.