Commit 8766708f authored by Mubeena Ishaq's avatar Mubeena Ishaq
Browse files

fix individual subscription GET method in meep-vis

parent 89310aa7
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -1108,20 +1108,22 @@ func individualSubscriptionGET(w http.ResponseWriter, r *http.Request) {

	w.Header().Set("Content-Type", "application/json; charset=UTF-8")
	vars := mux.Vars(r)
	subsIdStr := vars["subsId"]
	subsIdStr := vars["subscriptionId"]

	keyName := baseKey + "subscriptions:" + subsIdStr

	// Find subscription entry in Redis DB
	v2xMsgJson, _ := rc.JSONGetEntry(keyName, ".")
	if v2xMsgJson == "" {
		w.WriteHeader(http.StatusNotFound)
	v2xMsgJson, err := rc.JSONGetEntry(keyName, ".")
	if err != nil {
		err = errors.New("subscription not found against the provided subscriptionId")
		log.Error(err.Error())
		errHandlerProblemDetails(w, err.Error(), http.StatusNotFound)
		return
	}

	// Prepare & send v2xMsgSubscription as a response
	var v2xMsgSubResp V2xMsgSubscription
	err := json.Unmarshal([]byte(v2xMsgJson), &v2xMsgSubResp)
	err = json.Unmarshal([]byte(v2xMsgJson), &v2xMsgSubResp)
	if err != nil {
		log.Error(err.Error())
		errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError)