log query parameters also
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -16,6 +16,19 @@ func (h *Handler) GetIncident(w http.ResponseWriter, r *http.Request) {
|
||||
parts := strings.Split(path, "/")
|
||||
h.Logger.Debug("Request path", "parts", parts)
|
||||
|
||||
// Parse and write query parameters
|
||||
query := r.URL.Query()
|
||||
if len(query) == 0 {
|
||||
h.Logger.Debug("No query parameters.")
|
||||
} else {
|
||||
//fmt.Fprintln(w, "Query parameters:")
|
||||
for key, values := range query {
|
||||
for _, value := range values {
|
||||
h.Logger.Debug("Query Paramater", "key", key, "value", value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(parts) == 6 && strings.HasPrefix(path, "/api/now/table/incident/") {
|
||||
// Requested a single incident
|
||||
id := parts[5] // Extract {id}
|
||||
@@ -29,5 +42,5 @@ func (h *Handler) GetIncident(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
fmt.Fprintf(w, "{\"result\": {}}")
|
||||
fmt.Fprintf(w, "{\"result\": [{}]}")
|
||||
}
|
||||
|
Reference in New Issue
Block a user