mirror of
https://github.com/status-im/consul.git
synced 2025-02-08 11:54:12 +00:00
Test both ?pretty both bare and with value.
This commit is contained in:
parent
5ef79e747e
commit
a12ffef8b6
@ -127,6 +127,14 @@ func TestContentTypeIsJSON(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPrettyPrint(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)
|
dir, srv := makeHTTPServer(t)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
defer srv.Shutdown()
|
defer srv.Shutdown()
|
||||||
@ -139,7 +147,8 @@ func TestPrettyPrint(t *testing.T) {
|
|||||||
return r, nil
|
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)
|
srv.wrap(handler)(resp, req)
|
||||||
|
|
||||||
expected, _ := json.MarshalIndent(r, "", " ")
|
expected, _ := json.MarshalIndent(r, "", " ")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user