get error message from soap message

This commit is contained in:
w1ndyb0y
2020-09-16 22:53:57 +08:00
parent 4dcc256c28
commit 49d4b0c32a
3 changed files with 22 additions and 1 deletions
+2 -1
View File
@@ -51,7 +51,8 @@ func sendMessage(c *gin.Context) {
message.Priority, message.Event, message.Val, message.Msg)
url := getURL(message.URL)
resp := internal.Send(url, msg)
c.String(http.StatusOK, resp)
errMsg := internal.GetErrMsg(resp)
c.JSON(http.StatusOK, gin.H{"error": errMsg})
} else {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
}