more code
This commit is contained in:
@@ -9,12 +9,14 @@ import (
|
||||
"mocksnow/db/queries"
|
||||
"mocksnow/server/models"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// NewSnow receives data from the DMSP Snow New() function
|
||||
func (h *Handler) NewSnow(w http.ResponseWriter, r *http.Request) {
|
||||
var hostname string
|
||||
|
||||
reqBody, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
@@ -82,7 +84,15 @@ func (h *Handler) NewSnow(w http.ResponseWriter, r *http.Request) {
|
||||
// Simulate response
|
||||
ticket := fmt.Sprintf("TKT%06d", incidentRecord)
|
||||
sysID := uuid.New().String()
|
||||
recordLink := "https://server.fqdn.com/api/now/table/incident/" + sysID
|
||||
|
||||
// Produce dummy record link
|
||||
hostname, err = os.Hostname()
|
||||
if err != nil {
|
||||
h.Logger.Error("failed to lookup hostname", "error", err)
|
||||
hostname = "localhost"
|
||||
}
|
||||
|
||||
recordLink := fmt.Sprintf("https://%s/api/now/table/incident/%s", hostname, sysID)
|
||||
|
||||
response := models.IncidentResponse{
|
||||
ImportSet: randomImportSet(),
|
||||
|
Reference in New Issue
Block a user