Explorar el Código

encode json server usage api

Abhishek Kondur hace 2 años
padre
commit
e5990ba065
Se han modificado 2 ficheros con 6 adiciones y 3 borrados
  1. 4 1
      controllers/server.go
  2. 2 2
      ee/license.go

+ 4 - 1
controllers/server.go

@@ -49,7 +49,10 @@ func getUsage(w http.ResponseWriter, r *http.Request) {
 		serverUsage.Networks = len(networks)
 	}
 	w.Header().Set("Content-Type", "application/json")
-	json.NewEncoder(w).Encode(&serverUsage)
+	json.NewEncoder(w).Encode(models.SuccessResponse{
+		Code:     http.StatusOK,
+		Response: serverUsage,
+	})
 
 }
 

+ 2 - 2
ee/license.go

@@ -32,11 +32,11 @@ type apiServerConf struct {
 
 // AddLicenseHooks - adds the validation and cache clear hooks
 func AddLicenseHooks() {
-	logic.HookManangerCh <- models.HookDetails{
+	logic.HookManagerCh <- models.HookDetails{
 		Hook:     ValidateLicense,
 		Interval: time.Hour,
 	}
-	logic.HookManangerCh <- models.HookDetails{
+	logic.HookManagerCh <- models.HookDetails{
 		Hook:     ClearLicenseCache,
 		Interval: time.Hour,
 	}