Hi,
I’m trying to send some JSON data to an external web server
Example json:
{"status": {"current_time": "now"}}
Example .mls code
VAR
build_response: IPersistentObject;
build_response2: IPersistentObject;
message: string;
BEGIN
build_response := Factory.CreatePersistentObject;
build_response2 := Factory.CreatePersistentObject;
build_response2.SetString('current_time', 'now');
build_response.SetObject('status', build_response2);
message := build_response.AsJSon(true, true);
HTTPPostAsync('http://localhost:1885/mypage/section/playlist' , message);
END.
The message arrives with a content type:
“application/x-www-form-urlencoded” instead of the required “application/json”
This causes the receiving framework(s) to try to parse the body.
This breaks things.
I lose the body and need to recreate the json from a form dictionary. This dictionary does not allow duplicates, so duplicate fields and field delimiters are lost.
Is there a way to set the header correctly, or do I need to patch the receiving framework to accept this?