From 43f9842b6f7703e044bd667c7ea7cd8193be170b Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Sat, 3 Apr 2021 03:02:52 +0300 Subject: [PATCH] lib/proxy: log response body on non-200 response code This should improve debuggability for https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1179 --- lib/proxy/proxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/proxy/proxy.go b/lib/proxy/proxy.go index 207276cac..1bbd85d5b 100644 --- a/lib/proxy/proxy.go +++ b/lib/proxy/proxy.go @@ -159,7 +159,7 @@ func sendConnectRequest(proxyConn net.Conn, proxyAddr, dstAddr, authHeader strin return nil, fmt.Errorf("cannot read CONNECT response for dstAddr=%q: %w", dstAddr, err) } if statusCode := res.Header.StatusCode(); statusCode != 200 { - return nil, fmt.Errorf("unexpected status code received: %d; want: 200", statusCode) + return nil, fmt.Errorf("unexpected status code received: %d; want: 200; response body: %q", statusCode, res.Body()) } return conn, nil }