Skip to content

Commit

Permalink
address reviewer comments
Browse files Browse the repository at this point in the history
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
  • Loading branch information
hectorj2f committed Dec 5, 2023
1 parent 68a442d commit ef071ce
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/prober/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,16 @@ func rekorWriteEndpoint(ctx context.Context, cert *x509.Certificate, priv *ecdsa
defer resp.Body.Close()
exportDataToPrometheus(resp, rekorURL, endpoint, POST, latency)

if resp.StatusCode != http.StatusOK {
return fmt.Errorf("invalid status code when checking an entry in rekor: %s", resp.Status)
if resp.StatusCode != http.StatusCreated {
body, _ := io.ReadAll(resp.Body)
return fmt.Errorf("invalid status code '%s' when checking an entry in rekor with body '%s'", resp.Status, body)
}
// If entry was added successfully, we should verify it
var logEntry models.LogEntry
err = json.NewDecoder(resp.Body).Decode(&logEntry)
if err != nil {
return fmt.Errorf("error decoding the log entry with body '%v' and error: %w", resp.Body, err)
body, _ := io.ReadAll(resp.Body)
return fmt.Errorf("error decoding the log entry with body '%s' and error: %w", body, err)
}
var logEntryAnon models.LogEntryAnon
for _, e := range logEntry {
Expand Down

0 comments on commit ef071ce

Please sign in to comment.