Further research showed that TidHTTPClient and TIdMultiPartFormDataStream include '\ r \ n' up to the last parameter added. For instance,
http := TIdHTTP.Create(nil); params := TIdMultiPartFormDataStream.Create; params.AddFormField('param1', utf8encode('value1')); params.AddFormField('param2', utf8encode('value2')); params.AddFormField('param3', utf8encode('value3')); http.Post('myurl', params);
leads to
{"param1"=>"value1", "param2"=>"value2", "param3"=>"value3\r\n"}
Adding
params.AddFormField('', '');
after all the parameters solve the problem. Not an ideal solution, but at the moment this is normal.
source share