Files
mocksnow/server/handler/getIncident.go
Nathan Coad fe889a7a2c
All checks were successful
continuous-integration/drone/push Build is passing
more logging
2025-03-24 10:38:24 +11:00

28 lines
753 B
Go

package handler
import (
"net/http"
"strings"
)
// GetIncident responds to the link generated in the response to a New Snow
func (h *Handler) GetIncident(w http.ResponseWriter, r *http.Request) {
h.Logger.Debug("GetIncident Request received", "method", r.Method, "path", r.URL.Path)
// TODO
path := r.URL.Path
// Expected format: /api/now/table/incident/{id}
parts := strings.Split(path, "/")
h.Logger.Debug("Request path", "parts", parts)
if len(parts) != 6 || parts[1] != "api" || parts[2] != "now" || parts[3] != "table" || parts[4] != "incident" {
http.NotFound(w, r)
return
}
id := parts[5] // Extract {id}
h.Logger.Debug("GetIncident called", "id", id)
//fmt.Fprintf(w, "Incident ID: %s", id)
w.WriteHeader(http.StatusOK)
}