[신규] scada.utils에 webRequestPost() 함수 추가
이원종책임
0
1561
2022.07.11 10:58
웹 API와의 연동을 위한 webRequestPost()가 추가됨.
함수 시그니쳐 :
void webRequestPost(string url, string data, func({statusCode, statusText, data}) callBack = null, string contentType = "application/json")
사용 예시 :
function callBack(result){
console.log(result);
}
scada.utils.webRequestPost("https://httpbin.org/post", "aaaaa", callBack, "application/json; charset=utf-8");
//결과
//Object {statusCode: 200, statusText: "OK", data: "{
// "args": {},
// "data": "aaaaa",
// "files": {},
// "form": {},
// "headers": {
// "Content-Length": "5",
// "Content-Type": "application/json; charset=utf-8",
// "Host": "httpbin.org",
// "X-Amzn-Trace-Id": "Root=1-62cb84d5-417f232e3fc4f1f72604f84a"
// },
// "json": null,
// "origin": "106.250.131.11",
// "url": "https://httpbin.org/post"
// }
// "}