Skip to content

Commit 815cae0

Browse files
authored
fix: relaying error handling (#30)
1 parent 3c38441 commit 815cae0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

relay/controller.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,13 @@ func NewController(log *logrus.Entry, queue *RemoteQueue) *Controller {
2626
func (c *Controller) RelayRequest(w http.ResponseWriter, r *http.Request) {
2727
// clones the request
2828
r2 := r.Clone(context.Background())
29-
// TODO(eh-am): handle error
30-
body, _ := ioutil.ReadAll(r.Body)
29+
30+
body, err := ioutil.ReadAll(r.Body)
31+
if err != nil {
32+
c.log.Errorf("Failed to read a request for relay. Error: %+v", err)
33+
w.WriteHeader(500)
34+
return
35+
}
3136
r2.Body = ioutil.NopCloser(bytes.NewReader(body))
3237

3338
c.queue.Send(r2)

0 commit comments

Comments
 (0)