Refactor code in set response header

This commit is contained in:
HaoyangLiu 2018-10-04 18:50:15 +08:00
parent d46b5629c2
commit 31b26e7154
1 changed files with 3 additions and 4 deletions

View File

@ -14,6 +14,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/spf13/viper"
tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/client/utils"
)
// TODO these next two functions feel kinda hacky based on their placement
@ -157,8 +158,7 @@ func ValidatorSetRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
w.Write([]byte(err.Error()))
return
}
w.Header().Set("Content-Type", "application/json")
w.Write(output)
utils.PostProcessResponse(w, cdc, output, cliCtx.Indent)
}
}
@ -178,7 +178,6 @@ func LatestValidatorSetRequestHandlerFn(cliCtx context.CLIContext) http.HandlerF
w.Write([]byte(err.Error()))
return
}
w.Header().Set("Content-Type", "application/json")
w.Write(output)
utils.PostProcessResponse(w, cdc, output, cliCtx.Indent)
}
}