This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package handler
|
package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@@ -15,13 +16,18 @@ func (h *Handler) GetIncident(w http.ResponseWriter, r *http.Request) {
|
|||||||
parts := strings.Split(path, "/")
|
parts := strings.Split(path, "/")
|
||||||
h.Logger.Debug("Request path", "parts", parts)
|
h.Logger.Debug("Request path", "parts", parts)
|
||||||
|
|
||||||
if len(parts) != 6 || parts[1] != "api" || parts[2] != "now" || parts[3] != "table" || parts[4] != "incident" {
|
if len(parts) == 6 && strings.HasPrefix(path, "/api/now/table/incident/") {
|
||||||
http.NotFound(w, r)
|
// Requested a single incident
|
||||||
return
|
id := parts[5] // Extract {id}
|
||||||
|
h.Logger.Debug("GetIncident called for specific incident", "id", id)
|
||||||
|
} else if strings.HasPrefix(path, "/api/now/table/incident") {
|
||||||
|
h.Logger.Debug("GetIncident called for list of incidents")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
id := parts[5] // Extract {id}
|
// TODO - provide an incident list if necessary
|
||||||
h.Logger.Debug("GetIncident called", "id", id)
|
|
||||||
//fmt.Fprintf(w, "Incident ID: %s", id)
|
w.Header().Set("Content-Type", "application/json")
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
|
fmt.Fprintf(w, "{result: {}}")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user