This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user