1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-09 17:32:51 +00:00

updated saving temperatures end point

This commit is contained in:
2016-12-14 15:42:50 -06:00
parent d5a673613e
commit b90b94b544
2 changed files with 8 additions and 2 deletions

View File

@@ -27,6 +27,11 @@ func HandleSensorRequest(w http.ResponseWriter, r *http.Request, ps httprouter.P
//get request parameters - convert temp to float64
temperature, _ := strconv.ParseFloat(r.URL.Query().Get("temperature"), 64)
if temperature < -50 {
fmt.Fprint(w, "{ message: \"Bad temperature reading\"}")
return
}
location := r.URL.Query().Get("location")
t := time.Now()
@@ -214,4 +219,4 @@ func createResponse(s []daily_sensor.Data, err error) string{
}
return response
}
}