modified so ?pretty=anything will work
This commit is contained in:
parent
e31c6b8b83
commit
6c3aaa81c1
|
@ -138,13 +138,13 @@ func (s *HTTPServer) wrap(handler func(resp http.ResponseWriter, req *http.Reque
|
||||||
}
|
}
|
||||||
|
|
||||||
prettyPrint := false
|
prettyPrint := false
|
||||||
if req.URL.Query().Get("pretty") == "true" {
|
if req.URL.Query().Get("pretty") != "" {
|
||||||
prettyPrint = true
|
prettyPrint = true
|
||||||
}
|
}
|
||||||
// Write out the JSON object
|
// Write out the JSON object
|
||||||
if obj != nil {
|
if obj != nil {
|
||||||
var buf []byte
|
var buf []byte
|
||||||
if prettyPrint == true {
|
if prettyPrint {
|
||||||
buf, err = json.MarshalIndent(obj, "", " ")
|
buf, err = json.MarshalIndent(obj, "", " ")
|
||||||
} else {
|
} else {
|
||||||
buf, err = json.Marshal(obj)
|
buf, err = json.Marshal(obj)
|
||||||
|
|
Loading…
Reference in a new issue