Delphi 10 TRestClient MIME boundary issue

Viewed 702

I am trying to consume a REST service using TRestClient but I believe there is an issue with the boundary string for multipart content.

I am capturing the body of the request I am sending, and this is the content type header:

Content-Type: multipart/form-data; boundary=-------Embt-Boundary--07CC944C29DA577E

Then, this is the first section of the multipart form:

-----------Embt-Boundary--07CC944C29DA577E
Content-Disposition: form-data; name="file"; filename="ce.csv"
Content-Type: text/csv

And this is how it ends:

---------Embt-Boundary--07CC944C29DA577E--

I don't think this is an issue on the server, as even my proxy is not able to parse the body:

image

When I compare this same request vs postman, I notice that the starting and ending boundaries do not match!

Starting: -----------Embt-Boundary--07CC944C29DA577E
Ending:   ---------Embt-Boundary--07CC944C29DA577E-- 

I found that the boundary generation is done in TMultipartFormData.GenerateBoundary() from System.Net.Mime:

image

When checking the starting and ending boundaries from postman, they match, so I am almost sure this is the issue. I don't think it is related to my code, but let me know if you need it.

0 Answers
Related