rename to mocksnow

This commit is contained in:
2025-03-22 17:05:42 +11:00
parent c8c475911b
commit 112ad8da1a
33 changed files with 192 additions and 1802 deletions

View File

@@ -1,9 +1,11 @@
package handler
import (
"encoding/json"
"fmt"
"io"
"net/http"
"mocksnow/server/models"
)
// NewSnow receives data from the DMSP Snow New() function
@@ -19,4 +21,15 @@ func (h *Handler) NewSnow(w http.ResponseWriter, r *http.Request) {
} else {
h.Logger.Debug("received input data", "length", len(reqBody))
}
// Decode the JSON body
var inc models.Incident
if err := json.Unmarshal(reqBody, &inc); err != nil {
h.Logger.Error("unable to decode json", "error", err)
http.Error(w, "Invalid JSON body", http.StatusBadRequest)
return
} else {
h.Logger.Debug("successfully decoded JSON")
prettyPrint(inc)
}
}