feat(frpAct): add Windows/Systemd/Init.d service boot control. BUT WINDOWS STILL HAS BUGS AND LINUX HAS NOT BEEN TESTED.
This commit is contained in:
+4
-1
@@ -16,13 +16,16 @@ type Response struct {
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func SendErrorResponse(w http.ResponseWriter, statusCode int, message string) {
|
||||
func SendErrorResponse(w http.ResponseWriter, statusCode int, message string, data ...interface{}) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(statusCode)
|
||||
resp := Response{
|
||||
Success: false,
|
||||
Message: message,
|
||||
}
|
||||
if len(data) > 0 {
|
||||
resp.Data = data[0]
|
||||
}
|
||||
jsonResp, err := json.Marshal(resp)
|
||||
if err != nil {
|
||||
postLog.Error(fmt.Sprintf("Failed to marshal error response: %v", err))
|
||||
|
||||
Reference in New Issue
Block a user