You are not logged in.
MultiPartFormDataEncode in mormot1 and mormot2 adds "Content-Type: " prefix to ContentType.
If encoded data and ContentType is sent using THttpRequest.Request descendant, prefix is doubled with:
if InDataType<>'' then
InternalAddHeader(SockString('Content-Type: ')+InDataType);
So when sent to recipient ContentType will look like:
Content-Type: Content-Type: multipart/form-data; boundary=
Perhaps THttpRequest.Request should be updated to include "Content-Type:" only if InDataType doesn't have it.
Offline
This is documented as such:
// - MultiPartContentType: variable returning
// $ Content-Type: multipart/form-data; boundary=xxx
// where xxx is the first generated boundary
So it returns an header.
Just delete the first chars if you want to use it not as header but as content-type.
Online
mORMot2 cannot decode content encoded in mORMot1 with MultiPartFormDataAddField/MultiPartFormDataAddFile, it works other way around.
Here is code to reproduce it.
Last edited by igors233 (2024-08-29 06:37:01)
Offline
MultiPartFormDataDecode returns false.
mORMot1 encoded multipart content has boundary twice, at the begining of section, at the and, and there's also end boundary.
So mORMot2 fails to set Result
due to this part because j is not 0:
j := PosEx(boundary, Body, i);
if j = 0 then
begin
...
result := true;
end
while mORMot1 has same check but doesn't set Result at that place.
I'm not sure if mORMot1 including boundary twice is per standard, couldn't find anything saying it cannot be written twice so likely best thing is to change MultiPartFormDataDecode in mORMot2.
Offline