RPC returns pretty formated json

This commit is contained in:
Ethan Frey 2017-05-13 11:33:35 +02:00
parent 157ec8af2d
commit 2b324b7eb9
2 changed files with 3 additions and 3 deletions

View File

@ -539,7 +539,7 @@ func (wsc *wsConnection) writeRoutine() {
return
}
case msg := <-wsc.writeChan:
jsonBytes, err := json.Marshal(msg)
jsonBytes, err := json.MarshalIndent(msg, "", " ")
if err != nil {
wsc.Logger.Error("Failed to marshal RPCResponse to JSON", "error", err)
} else {

View File

@ -48,7 +48,7 @@ func StartHTTPServer(listenAddr string, handler http.Handler, logger log.Logger)
}
func WriteRPCResponseHTTPError(w http.ResponseWriter, httpCode int, res types.RPCResponse) {
jsonBytes, err := json.Marshal(res)
jsonBytes, err := json.MarshalIndent(res, "", " ")
if err != nil {
panic(err)
}
@ -59,7 +59,7 @@ func WriteRPCResponseHTTPError(w http.ResponseWriter, httpCode int, res types.RP
}
func WriteRPCResponseHTTP(w http.ResponseWriter, res types.RPCResponse) {
jsonBytes, err := json.Marshal(res)
jsonBytes, err := json.MarshalIndent(res, "", " ")
if err != nil {
panic(err)
}