diff --git a/@ArmA3URLFetch/addons/common/functions/fn_addClient.sqf b/@ArmA3URLFetch/addons/common/functions/fn_addClient.sqf index 1bece48..c52178e 100644 --- a/@ArmA3URLFetch/addons/common/functions/fn_addClient.sqf +++ b/@ArmA3URLFetch/addons/common/functions/fn_addClient.sqf @@ -16,8 +16,8 @@ params [ ["_url", "", [""]], ["_method", "", [""]], - ["_params", [], [[]]], ["_headers", [], [[]]], + ["_postData", "", [[], ""]], //<- can be array of strings or a string ["_decodeJson", false, [false]] ]; @@ -30,8 +30,13 @@ if (_method != "") then { _args append ["#method", _method]; }; -if ((count _params) > 0) then { - _args append _params; +if (_postData isEqualType "" && { _postData != "" }) then { + _args append ["#postData", _postData]; +} else { + if (_postData isEqualType [] && { (count _postData) > 0 }) then { + _args pushBack "#postData"; + _args append _postData; + }; }; if ((count _headers) > 0) then { diff --git a/@ArmA3URLFetch/addons/common/functions/fn_request.sqf b/@ArmA3URLFetch/addons/common/functions/fn_request.sqf index f73a699..28bdd96 100644 --- a/@ArmA3URLFetch/addons/common/functions/fn_request.sqf +++ b/@ArmA3URLFetch/addons/common/functions/fn_request.sqf @@ -17,7 +17,7 @@ params [ ["_url", "", [""]], ["_method", "", [""]], ["_headers", [], [[]]], - ["_postData", "", [""]], + ["_postData", "", ["", []]], ["_decodeJson", false, [false]] ]; @@ -36,8 +36,13 @@ if (_decodeJson) then { _args pushBack "#jsonToArray"; }; -if (_postData != "") then { +if (_postData isEqualType "" && { _postData != "" }) then { _args append ["#postData", _postData]; +} else { + if (_postData isEqualType [] && { (count _postData) > 0 }) then { + _args pushBack "#postData"; + _args append _postData; + }; }; if ((count _headers) > 0) then { diff --git a/@ArmA3URLFetch/addons/common/functions/fn_setClient.sqf b/@ArmA3URLFetch/addons/common/functions/fn_setClient.sqf index b7c86e2..deed7b1 100644 --- a/@ArmA3URLFetch/addons/common/functions/fn_setClient.sqf +++ b/@ArmA3URLFetch/addons/common/functions/fn_setClient.sqf @@ -22,8 +22,8 @@ params [ ["_cid", 0, [0]], ["_url", "", [""]], ["_method", "", [""]], - ["_params", [], [[]]], ["_headers", [], [[]]], + ["_postData", [], ["", []]], ["_decodeJson", false, [false]] ]; @@ -43,9 +43,13 @@ if (_decodeJson) then { _args pushBack "#jsonToArray"; }; -if ((count _params) > 0) then { - _args pushBack "#parameters"; - _args append _params; +if (_postData isEqualType "" && { _postData != "" }) then { + _args append ["#postData", _postData]; +} else { + if (_postData isEqualType [] && { (count _postData) > 0 }) then { + _args pushBack "#postData"; + _args append _postData; + }; }; if ((count _headers) > 0) then {