Skip to content

Commit

Permalink
misc: take errs into account
Browse files Browse the repository at this point in the history
Signed-off-by: Hidde Beydals <[email protected]>
  • Loading branch information
hiddeco committed Oct 11, 2023
1 parent bdda580 commit edb6a54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion internal/server/event_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ func (s *EventServer) eventMiddleware(h http.Handler) http.Handler {
w.WriteHeader(http.StatusBadRequest)
return
}
r.Body.Close()
if err := r.Body.Close(); err != nil {
s.logger.Error(err, "closing the request body failed")
w.WriteHeader(http.StatusBadRequest)
return
}
r.Body = io.NopCloser(bytes.NewBuffer(body))

event := &eventv1.Event{}
Expand Down
2 changes: 1 addition & 1 deletion internal/server/receiver_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ func Test_handlePayload(t *testing.T) {
g.Expect(rr.Result().StatusCode).To(gomega.Equal(tt.expectedResponseCode))

var allReceivers apiv1.ReceiverList
err = client.List(context.TODO(), &allReceivers)
g.Expect(client.List(context.TODO(), &allReceivers)).To(gomega.Succeed())

var annotatedResources int
for _, obj := range allReceivers.Items {
Expand Down

0 comments on commit edb6a54

Please sign in to comment.