merge poc

This commit is contained in:
mrjoelkamp
2024-05-23 10:52:35 -05:00
parent 3d0519f92a
commit f91a423ef6
22 changed files with 1133 additions and 277 deletions

View File

@@ -32,9 +32,16 @@ func SendResponse(results *[]externaldata.Item, systemErr string, w http.Respons
klog.InfoS("sending response", "response", response)
w.WriteHeader(http.StatusOK)
if err := json.NewEncoder(w).Encode(response); err != nil {
klog.ErrorS(err, "unable to encode response")
body, err := json.Marshal(response)
if err != nil {
klog.ErrorS(err, "unable to marshal response")
os.Exit(1)
}
w.Header().Set("Content-Type", "application/json")
_, err = w.Write(body)
if err != nil {
klog.ErrorS(err, "unable to write response")
os.Exit(1)
}
}