more logging
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-03-24 10:38:24 +11:00
parent 6c432f7cb1
commit fe889a7a2c
4 changed files with 43 additions and 5 deletions

View File

@@ -1,19 +1,19 @@
package handler
import (
"fmt"
"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)
@@ -21,5 +21,7 @@ func (h *Handler) GetIncident(w http.ResponseWriter, r *http.Request) {
}
id := parts[5] // Extract {id}
fmt.Fprintf(w, "Incident ID: %s", id)
h.Logger.Debug("GetIncident called", "id", id)
//fmt.Fprintf(w, "Incident ID: %s", id)
w.WriteHeader(http.StatusOK)
}