Refactor code to improve error handling and remove unused functions

This commit is contained in:
ProtoTess
2025-11-11 02:32:23 +00:00
parent 3bf078ed3f
commit c3e6ed80c1
5 changed files with 14 additions and 31 deletions
+3 -3
View File
@@ -52,7 +52,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.sendFault(w, "Receiver", "Failed to read request body", err.Error())
return
}
defer r.Body.Close()
_ = r.Body.Close()
// Extract action from raw XML first (before parsing)
action := h.extractAction(body)
@@ -177,7 +177,7 @@ func (h *Handler) sendResponse(w http.ResponseWriter, response interface{}) {
// Send response
w.Header().Set("Content-Type", "application/soap+xml; charset=utf-8")
w.WriteHeader(http.StatusOK)
w.Write(xmlBody)
_, _ = w.Write(xmlBody)
}
// sendFault sends a SOAP fault response
@@ -207,7 +207,7 @@ func (h *Handler) sendFault(w http.ResponseWriter, code, reason, detail string)
// Send fault response
w.Header().Set("Content-Type", "application/soap+xml; charset=utf-8")
w.WriteHeader(http.StatusInternalServerError)
w.Write(xmlBody)
_, _ = w.Write(xmlBody)
}
// RequestWrapper wraps incoming SOAP request structures