Fix: api invalid returning
This commit is contained in:
parent
5920b05752
commit
7a0717830c
2 changed files with 4 additions and 4 deletions
|
@ -59,7 +59,7 @@ func findProxyByName(next http.Handler) http.Handler {
|
||||||
|
|
||||||
func getProxies(w http.ResponseWriter, r *http.Request) {
|
func getProxies(w http.ResponseWriter, r *http.Request) {
|
||||||
proxies := T.Instance().Proxies()
|
proxies := T.Instance().Proxies()
|
||||||
render.JSON(w, r, map[string]map[string]C.Proxy{
|
render.JSON(w, r, render.M{
|
||||||
"proxies": proxies,
|
"proxies": proxies,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ func getProxyDelay(w http.ResponseWriter, r *http.Request) {
|
||||||
render.Status(r, http.StatusServiceUnavailable)
|
render.Status(r, http.StatusServiceUnavailable)
|
||||||
render.JSON(w, r, newError("An error occurred in the delay test"))
|
render.JSON(w, r, newError("An error occurred in the delay test"))
|
||||||
} else {
|
} else {
|
||||||
render.JSON(w, r, map[string]int16{
|
render.JSON(w, r, render.M{
|
||||||
"delay": t,
|
"delay": t,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ type Rule struct {
|
||||||
func getRules(w http.ResponseWriter, r *http.Request) {
|
func getRules(w http.ResponseWriter, r *http.Request) {
|
||||||
rawRules := T.Instance().Rules()
|
rawRules := T.Instance().Rules()
|
||||||
|
|
||||||
var rules []Rule
|
rules := []Rule{}
|
||||||
for _, rule := range rawRules {
|
for _, rule := range rawRules {
|
||||||
rules = append(rules, Rule{
|
rules = append(rules, Rule{
|
||||||
Type: rule.RuleType().String(),
|
Type: rule.RuleType().String(),
|
||||||
|
@ -33,7 +33,7 @@ func getRules(w http.ResponseWriter, r *http.Request) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
render.JSON(w, r, map[string][]Rule{
|
render.JSON(w, r, render.M{
|
||||||
"rules": rules,
|
"rules": rules,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue