Skip to content

Commit

Permalink
updated rest endpoints responses
Browse files Browse the repository at this point in the history
  • Loading branch information
kqdeng committed Jul 12, 2020
1 parent 0554bd4 commit f730101
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions http-server/http-handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func RegisterHardwareServiceHandlerFromEndpoint(ctx context.Context, mux *runtim
writeResponse(w, http.StatusInternalServerError, err.Error())
return
}
writeResponse(w, http.StatusOK, `{"status": "ok", "msg": "Hardware data pushed successfully"}`)
writeResponse(w, http.StatusOK, fmt.Sprintf(`{"status": "ok", "msg": "hardware data pushed successfully", "id": "%v"}`, hw.Id))
})

// hardware mac handler | POST /v1/hardware/mac
Expand Down Expand Up @@ -207,7 +207,7 @@ func RegisterHardwareServiceHandlerFromEndpoint(ctx context.Context, mux *runtim
writeResponse(w, http.StatusInternalServerError, err.Error())
return
}
writeResponse(w, http.StatusOK, fmt.Sprintf(`{"status": "ok", "msg": "Hardware %v deleted successfully"}`, dr.Id))
writeResponse(w, http.StatusOK, fmt.Sprintf(`{"status": "ok", "msg": "hardware deleted successfully", "id": "%v"}`, dr.Id))
})

return nil
Expand Down Expand Up @@ -261,7 +261,7 @@ func RegisterTemplateHandlerFromEndpoint(ctx context.Context, mux *runtime.Serve
writeResponse(w, http.StatusInternalServerError, err.Error())
return
}
writeResponse(w, http.StatusOK, fmt.Sprintf(`{"status": "ok", "msg": "Created Template: %v"}`, res.Id))
writeResponse(w, http.StatusOK, fmt.Sprintf(`{"status": "ok", "msg": "created template", "id": "%v"}`, res.Id))
}
})

Expand Down Expand Up @@ -313,7 +313,7 @@ func RegisterTemplateHandlerFromEndpoint(ctx context.Context, mux *runtime.Serve
writeResponse(w, http.StatusInternalServerError, err.Error())
return
}
writeResponse(w, http.StatusOK, fmt.Sprintf(`{"status": "ok", "msg": "Template %v deleted successfully"}`, gr.Id))
writeResponse(w, http.StatusOK, fmt.Sprintf(`{"status": "ok", "msg": "template deleted successfully", "id": "%v"}`, gr.Id))
})

// template list handler | GET /v1/templates
Expand Down

0 comments on commit f730101

Please sign in to comment.