Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters Order in a post query is not respected #1937

Closed
Soft-jp opened this issue Sep 28, 2022 · 6 comments
Closed

Parameters Order in a post query is not respected #1937

Soft-jp opened this issue Sep 28, 2022 · 6 comments

Comments

@Soft-jp
Copy link

Soft-jp commented Sep 28, 2022

Describe the bug
After update restsharp 106.15 to 108.0.2 , the order of the parameters is not respected.

To Reproduce

var request = new RestRequest("/de/cfes/{cfeId}/", Method.Post);
request.AddUrlSegment("cfeId", cfeId);
request.AddParameter("title", dcore.title);
request.AddParameter("creator", dcore.creator);
request.AddFile("dataObject", file, "application/pdf");

Expected behavior
I expect to have the dataObject parameter at the end of my post which was the case with version 106.15 but not anymore. It is at the beginning.

Stack trace

POST https://xxxx/de/cfes/AVplNP7oFSCAANm5/ HTTP/1.1
Accept: text/xml
Authorization: Basic ZGVwb3QudGVzdEBibG9vbS10ZWNobm9sb2d5LmZyOm5RTko5NF4zdE1ZZSh+
User-Agent: RestSharp/106.15.0.0
Content-Type: multipart/mixed; boundary=---------157ADA56-F062-4F35-914F-B35957586B43
Host: test.arkhineo.fr
Content-Length: 48002
Accept-Encoding: gzip, deflate

-----------157ADA56-F062-4F35-914F-B35957586B43

Content-Disposition: form-data; name="title"

TestTitle
-----------157ADA56-F062-4F35-914F-B35957586B43
Content-Disposition: form-data; name="creator"

TestCreator
-----------157ADA56-F062-4F35-914F-B35957586B43
Content-Disposition: form-data; name="dataObject"; filename="test.pdf"
Content-Type: application/pdf

%PDF-1.4
% 쏢
....
trailer
<< /Size 33 /Root 1 0 R /Info 2 0 R
/ID [<11FBFF766390B6E2798152989FA02F4E><11FBFF766390B6E2798152989FA02F4E>]

startxref
44237
%%EOF

-----------157ADA56-F062-4F35-914F-B35957586B43--


POST https://xxx/de/cfes/AVplNP7oFSCAANm5/ HTTP/1.1
Accept: text/xml
Authorization: Basic ZGVwb3QudGVzdEBibG9vbS10ZWNobm9sb2d5LmZyOm5RTko5NF4zdE1ZZSh+
User-Agent: RestSharp/108.0.2.0
Content-Type: multipart/mixed; boundary="8df57e66-ec8f-47d0-aba3-46b5379bbb11"
Host: test.arkhineo.fr
Content-Length: 48330
Accept-Encoding: gzip
Connection: Keep-Alive

--8df57e66-ec8f-47d0-aba3-46b5379bbb11
Content-Type: application/pdf
Content-Disposition: form-data; name="dataObject"; filename="BLT_AMROUNEMyriam_20190531.pdf"

%PDF-1.4
% 쏢
%%Invocation: gs ? -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/screen -dPDFA=1 -sPDFACompatibilityPolicy=? -sColorConversionStrategy=UseDeviceIndependentColor -dPDFACompatibilityPolicy=1 -sOutputFile=? -f ?
5 0 obj
<</Length 6 0 R/Filter /FlateDecode>>
stream
................
44237
%%EOF

--8df57e66-ec8f-47d0-aba3-46b5379bbb11
Content-Type: text/plain; charset=utf-8
Content-Disposition: form-data; name="title"

TestTitle
--8df57e66-ec8f-47d0-aba3-46b5379bbb11
Content-Type: text/plain; charset=utf-8
Content-Disposition: form-data; name="creator"

TestCreator

Desktop (please complete the following information):

  • .NET 6
@Soft-jp Soft-jp added the bug label Sep 28, 2022
@stale
Copy link

stale bot commented Oct 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 30, 2022
@repo-ranger
Copy link

repo-ranger bot commented Oct 30, 2022

⚠️ This issue has been marked wontfix and will be closed in 3 days

@repo-ranger repo-ranger bot closed this as completed Nov 2, 2022
@muhmuhhum
Copy link

I am running in to the same issue with multipart formdata i hava a external api i need to call and it needs the block with paramters before the block with the file

@alexeyzimarev
Copy link
Member

Having parameters before the file can actually be fixed.

@muhmuhhum
Copy link

@alexeyzimarev How can i do this ?

@alexeyzimarev
Copy link
Member

You can open a PR. It should be an easy fix just to reorder the content population.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants