From 59d4f20e621d84ce8858bb174720a343f9f13b01 Mon Sep 17 00:00:00 2001 From: Thordur Bjornsson Date: Fri, 2 Jan 2015 09:14:44 +0100 Subject: [PATCH] Test both ?pretty both bare and with value. --- command/agent/http_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/command/agent/http_test.go b/command/agent/http_test.go index 230832128..6814faa00 100644 --- a/command/agent/http_test.go +++ b/command/agent/http_test.go @@ -127,6 +127,14 @@ func TestContentTypeIsJSON(t *testing.T) { } func TestPrettyPrint(t *testing.T) { + testPrettyPrint("pretty=1", t) +} + +func TestPrettyPrintBare(t *testing.T) { + testPrettyPrint("pretty", t) +} + +func testPrettyPrint(pretty string, t *testing.T) { dir, srv := makeHTTPServer(t) defer os.RemoveAll(dir) defer srv.Shutdown() @@ -139,7 +147,8 @@ func TestPrettyPrint(t *testing.T) { return r, nil } - req, _ := http.NewRequest("GET", "/v1/kv/key?pretty=1", nil) + urlStr := "/v1/kv/key?" + pretty + req, _ := http.NewRequest("GET", urlStr, nil) srv.wrap(handler)(resp, req) expected, _ := json.MarshalIndent(r, "", " ")