diff --git a/api/rest-api.go b/api/rest-api.go index 874696e..d09759d 100644 --- a/api/rest-api.go +++ b/api/rest-api.go @@ -257,6 +257,12 @@ func (api *weatherRestApi) updateWeatherSensorHandler(w http.ResponseWriter, r * } sensor.Id = sensorId + exist, err := api.sensorRegistry.ExistSensor(sensorId) + if !exist || err != nil { + http.Error(w, "", http.StatusNotFound) + return + } + err = api.sensorRegistry.UpdateSensor(&sensor) if err != nil { http.Error(w, "", http.StatusBadRequest)