Moge-Row commited on
Commit
272c004
·
1 Parent(s): f892023

fix genkey response

Browse files
Files changed (1) hide show
  1. internal/handler/keys.go +2 -1
internal/handler/keys.go CHANGED
@@ -112,7 +112,8 @@ func HandleGenKey(w http.ResponseWriter, r *http.Request) {
112
  }
113
  key := GenerateKey(name)
114
  w.Header().Set("Content-Type", "application/json")
115
- fmt.Fprintf(w, "%s", "{"key":""+key+"","name":""+name+""}")
 
116
  }
117
 
118
  func HandleStats(w http.ResponseWriter, r *http.Request) {
 
112
  }
113
  key := GenerateKey(name)
114
  w.Header().Set("Content-Type", "application/json")
115
+ resp := map[string]string{"key": key, "name": name}
116
+ json.NewEncoder(w).Encode(resp)
117
  }
118
 
119
  func HandleStats(w http.ResponseWriter, r *http.Request) {