"log"
"os"
"os/exec"
+ "restapi/httpclient"
"strconv"
"strings"
)
} else {
targetURL := p.notificationTargetURL + ConstServiceStatusNotiURI + strconv.FormatUint(p.serviceID, 10)
- _, err = sendPostJSONMsg(targetURL, reqbytes)
+ _, err = httpclient.DoPost(targetURL, reqbytes)
if err != nil {
log.Println(err.Error())
}
"log"
"net"
"os/exec"
+ "restapi/httpclient"
"strconv"
"strings"
)
reqBytes, _ := json.Marshal(appInfo)
executeTarget := target + ":" + strconv.Itoa(ConstWellknownPort) + ConstServiceExecuteURI
- str, err := sendPostJSONMsg(executeTarget, reqBytes)
+ respBytes, err := httpclient.DoPost(executeTarget, reqBytes)
- if err == nil {
- if str == ConstServiceStatusFailed {
- err = errors.New("Failed")
- }
+ var responseMsg map[string]interface{}
+
+ err = json.Unmarshal(respBytes, &responseMsg)
+ if err != nil {
+ return
+ }
+
+ log.Println("[JSON] : ", responseMsg)
+
+ str := responseMsg[ConstKeyStatus].(string)
+ if str == ConstServiceStatusFailed {
+ err = errors.New(ConstServiceStatusFailed)
}
return