Skip to content

Commit

Permalink
update SQF functions
Browse files Browse the repository at this point in the history
  • Loading branch information
pixlcrashr committed Jul 6, 2018
1 parent 67d3d4f commit f234888
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
11 changes: 8 additions & 3 deletions @ArmA3URLFetch/addons/common/functions/fn_addClient.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
params [
["_url", "", [""]],
["_method", "", [""]],
["_params", [], [[]]],
["_headers", [], [[]]],
["_postData", "", [[], ""]], //<- can be array of strings or a string
["_decodeJson", false, [false]]
];

Expand All @@ -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 {
Expand Down
9 changes: 7 additions & 2 deletions @ArmA3URLFetch/addons/common/functions/fn_request.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ params [
["_url", "", [""]],
["_method", "", [""]],
["_headers", [], [[]]],
["_postData", "", [""]],
["_postData", "", ["", []]],
["_decodeJson", false, [false]]
];

Expand All @@ -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 {
Expand Down
12 changes: 8 additions & 4 deletions @ArmA3URLFetch/addons/common/functions/fn_setClient.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ params [
["_cid", 0, [0]],
["_url", "", [""]],
["_method", "", [""]],
["_params", [], [[]]],
["_headers", [], [[]]],
["_postData", [], ["", []]],
["_decodeJson", false, [false]]
];

Expand All @@ -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 {
Expand Down

0 comments on commit f234888

Please sign in to comment.