From 1d34034443ae9bece2607808f0123b4520973c53 Mon Sep 17 00:00:00 2001 From: "Daniel A. Nagy" Date: Fri, 18 Mar 2016 13:30:31 +0100 Subject: [PATCH] Additional error handling in roundtripper. --- swarm/api/http/roundtripper.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/swarm/api/http/roundtripper.go b/swarm/api/http/roundtripper.go index ef2553118a..69c501e5be 100644 --- a/swarm/api/http/roundtripper.go +++ b/swarm/api/http/roundtripper.go @@ -45,6 +45,9 @@ func (self *RoundTripper) RoundTrip(req *http.Request) (resp *http.Response, err } url := fmt.Sprintf("http://%s:%s/%s:/%s/%s", host, self.Port, req.Proto, req.URL.Host, req.URL.Path) glog.V(logger.Info).Infof("[BZZ] roundtripper: proxying request '%s' to '%s'", req.RequestURI, url) - reqProxy, _ := http.NewRequest(req.Method, url, req.Body) + reqProxy, err := http.NewRequest(req.Method, url, req.Body) + if err != nil { + return nil, err + } return http.DefaultClient.Do(reqProxy) }