From 483a535ba2f3caa74c3591b65e2e813e946a5211 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Tue, 27 Jan 2015 09:45:17 +0000
Subject: [PATCH] fix some typos in the debug handlers

---
 fe/http_debug.go | 2 +-
 fe/http_test.go  | 3 +++
 fe/lbv2/debug.go | 5 +++--
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/fe/http_debug.go b/fe/http_debug.go
index cb656ef3..bdbc6322 100644
--- a/fe/http_debug.go
+++ b/fe/http_debug.go
@@ -13,7 +13,7 @@ const debugText = `<html>
     <body>
     <title>Requests</title>
     <table>
-      <tr><th>IP</th><th>URL</th><th>Target</th></tr>
+      <tr><th>IP</th><th>URL</th><th>State</th><th>Target</th></tr>
       {{range .}}
       <tr>
         <td align=left>{{.RemoteAddr}}</td>
diff --git a/fe/http_test.go b/fe/http_test.go
index 2b849fc6..d944540d 100644
--- a/fe/http_test.go
+++ b/fe/http_test.go
@@ -111,6 +111,9 @@ func TestHttpRedirector_LBDebugPage(t *testing.T) {
 	if !strings.Contains(data, "node1") {
 		t.Errorf("Bad response:\n%s", data)
 	}
+	if strings.Contains(data, "error executing template") {
+		t.Errorf("Error executing template:\n%s", data)
+	}
 }
 
 type httpTestContext struct {
diff --git a/fe/lbv2/debug.go b/fe/lbv2/debug.go
index 6bf69cdd..9e3a373c 100644
--- a/fe/lbv2/debug.go
+++ b/fe/lbv2/debug.go
@@ -18,10 +18,11 @@ const debugText = `<html>
       <tr>
         <td>{{.Name}}</td>
         <td>{{.Requests}}</td>
+        {{$data := .Data}}
         {{range $d := $dimensions}}
-          {{$data := index .Data $d}}
+          {{$cur := index $data $d}}
           <td>
-          {{$data.PredictedUtilization}}/{{$data.ReportedUtilization}}/{{$data.Cost}}
+          {{$cur.PredictedUtilization}}/{{$cur.ReportedUtilization}}/{{$cur.Cost}}
           </td>
         {{end}}
       </tr>
-- 
GitLab