Skip to content

Commit

Permalink
Remove panic
Browse files Browse the repository at this point in the history
  • Loading branch information
alpe committed Jan 16, 2024
1 parent 296c6c4 commit 4299373
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/proxy/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"errors"
"io"
"log"
"math/rand"
"net/http"
"time"
Expand Down Expand Up @@ -60,7 +61,9 @@ func (r RetryMiddleware) ServeHTTP(writer http.ResponseWriter, request *http.Req
// call next handler in chain
req, err := http.NewRequestWithContext(request.Context(), request.Method, request.URL.String(), lazyBody)
if err != nil {
panic(err)
log.Printf("clone request: %v", err)
writer.WriteHeader(http.StatusInternalServerError)
return
}
r.nextHandler.ServeHTTP(capturedResp, req)
lazyBody.Capture()
Expand Down

0 comments on commit 4299373

Please sign in to comment.