Skip to content

Commit

Permalink
Add even more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejoh committed Nov 25, 2024
1 parent 09e05d7 commit f46089e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"flag"
"fmt"
"io"
"log"
"net/http"
"strings"
Expand Down Expand Up @@ -73,6 +74,15 @@ func imagineHandler(imageName string) http.HandlerFunc {
}

var admissionReview admission.AdmissionReview

body, err := io.ReadAll(r.Body)
if err != nil {
log.Printf("Failed to read request body: %v", err)
http.Error(w, "could not read request body", http.StatusBadRequest)
return
}

log.Printf("Raw JSON request body: %s", string(body))
if err := json.NewDecoder(r.Body).Decode(&admissionReview); err != nil {
log.Printf("Failed to decode request body: %v", err)
http.Error(w, "could not decode request body", http.StatusBadRequest)
Expand Down

0 comments on commit f46089e

Please sign in to comment.