Loading go-apps/meep-vis/server/vis.go +8 −12 Original line number Diff line number Diff line Loading @@ -929,6 +929,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { var extractSubType SubscriptionCommon bodyBytes, _ := ioutil.ReadAll(r.Body) err := json.Unmarshal(bodyBytes, &extractSubType) if err != nil { log.Error(err.Error()) Loading @@ -936,6 +937,12 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { return } if extractSubType.SubscriptionType == "" { log.Error("Mandatory SubscriptionType parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute SubscriptionType is missing in the request body.", http.StatusBadRequest) return } //extract subscription type subscriptionType := extractSubType.SubscriptionType Loading @@ -954,6 +961,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { case V2X_MSG: var v2xSubscription V2xMsgSubscription err = json.Unmarshal(bodyBytes, &v2xSubscription) if err != nil { log.Error(err.Error()) Loading @@ -962,24 +970,12 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { } // Validating mandatory parameters provided in the request body if v2xSubscription.SubscriptionType == "" { log.Error("Mandatory SubscriptionType parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute SubscriptionType is missing in the request body.", http.StatusBadRequest) return } if v2xSubscription.Links != nil { log.Error("Links attribute should not be present in request body") errHandlerProblemDetails(w, "Links attribute should not be present in request body.", http.StatusBadRequest) return } if v2xSubscription.SubscriptionType != "V2xMsgSubscription" { log.Error("SubscriptionType should be set to V2xMsgSubscription") errHandlerProblemDetails(w, "SubscriptionType should be set to V2xMsgSubscription in the request body.", http.StatusBadRequest) return } if v2xSubscription.FilterCriteria == nil { log.Error("Mandatory FilterCriteria parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute FilterCriteria is missing in the request body.", http.StatusBadRequest) Loading Loading
go-apps/meep-vis/server/vis.go +8 −12 Original line number Diff line number Diff line Loading @@ -929,6 +929,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { var extractSubType SubscriptionCommon bodyBytes, _ := ioutil.ReadAll(r.Body) err := json.Unmarshal(bodyBytes, &extractSubType) if err != nil { log.Error(err.Error()) Loading @@ -936,6 +937,12 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { return } if extractSubType.SubscriptionType == "" { log.Error("Mandatory SubscriptionType parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute SubscriptionType is missing in the request body.", http.StatusBadRequest) return } //extract subscription type subscriptionType := extractSubType.SubscriptionType Loading @@ -954,6 +961,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { case V2X_MSG: var v2xSubscription V2xMsgSubscription err = json.Unmarshal(bodyBytes, &v2xSubscription) if err != nil { log.Error(err.Error()) Loading @@ -962,24 +970,12 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { } // Validating mandatory parameters provided in the request body if v2xSubscription.SubscriptionType == "" { log.Error("Mandatory SubscriptionType parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute SubscriptionType is missing in the request body.", http.StatusBadRequest) return } if v2xSubscription.Links != nil { log.Error("Links attribute should not be present in request body") errHandlerProblemDetails(w, "Links attribute should not be present in request body.", http.StatusBadRequest) return } if v2xSubscription.SubscriptionType != "V2xMsgSubscription" { log.Error("SubscriptionType should be set to V2xMsgSubscription") errHandlerProblemDetails(w, "SubscriptionType should be set to V2xMsgSubscription in the request body.", http.StatusBadRequest) return } if v2xSubscription.FilterCriteria == nil { log.Error("Mandatory FilterCriteria parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute FilterCriteria is missing in the request body.", http.StatusBadRequest) Loading