Browse Source

fix lint: Json => JSON

pull/285/head
yedf2 4 years ago
parent
commit
610b50f9c8
  1. 4
      dtmcli/types.go
  2. 2
      dtmutil/utils.go

4
dtmcli/types.go

@ -82,9 +82,9 @@ func SetPassthroughHeaders(headers []string) {
dtmimp.PassthroughHeaders = headers
}
// Result2HttpJson return the http code and json result
// Result2HttpJSON return the http code and json result
// if result is error, the return proper code, else return StatusOK
func Result2HttpJson(result interface{}) (code int, res interface{}) {
func Result2HttpJSON(result interface{}) (code int, res interface{}) {
err, _ := result.(error)
if err == nil {
code = http.StatusOK

2
dtmutil/utils.go

@ -52,7 +52,7 @@ func WrapHandler(fn func(*gin.Context) interface{}) gin.HandlerFunc {
return func(c *gin.Context) {
began := time.Now()
ret := fn(c)
status, res := dtmcli.Result2HttpJson(ret)
status, res := dtmcli.Result2HttpJSON(ret)
b, _ := json.Marshal(res)
if status == http.StatusOK || status == http.StatusTooEarly {

Loading…
Cancel
Save