finding a bug

This commit is contained in:
Daniel Ledda
2020-11-01 01:30:21 +01:00
parent 6fa4faacb6
commit 746e1010fa

View File

@@ -47,17 +47,15 @@ func main() {
} }
func viewHandler(w http.ResponseWriter, r *http.Request) { func viewHandler(w http.ResponseWriter, r *http.Request) {
fmt.Println("Request received") fmt.Println(r.Method)
var snapshotSub SnapshotSubmission var snapshotSub SnapshotSubmission
body, err := ioutil.ReadAll(r.Body) body, err := ioutil.ReadAll(r.Body)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
fmt.Printf("%s", body)
err = json.Unmarshal(body, &snapshotSub) err = json.Unmarshal(body, &snapshotSub)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
fmt.Printf("%v\n", snapshotSub)
_, _ = fmt.Fprint(w, "<h1>Climate Stuff</h1><div>The data will show up here at some stage...</div>") _, _ = fmt.Fprint(w, "<h1>Climate Stuff</h1><div>The data will show up here at some stage...</div>")
} }