()
| 80 | } |
| 81 | |
| 82 | func schemaValidateHandler() http.Handler { |
| 83 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 84 | sch := readRequest(w, r) |
| 85 | w.Header().Set("Content-Type", "application/json") |
| 86 | |
| 87 | err := admin.SchemaValidate(string(sch)) |
| 88 | if err == nil { |
| 89 | w.WriteHeader(http.StatusOK) |
| 90 | x.SetStatus(w, "success", "Schema is valid") |
| 91 | return |
| 92 | } |
| 93 | |
| 94 | w.WriteHeader(http.StatusBadRequest) |
| 95 | errs := strings.Split(strings.TrimSpace(err.Error()), "\n") |
| 96 | x.SetStatusWithErrors(w, x.ErrorInvalidRequest, errs) |
| 97 | }) |
| 98 | } |
| 99 | |
| 100 | func drainingHandler(w http.ResponseWriter, r *http.Request) { |
| 101 | enableStr := r.URL.Query().Get("enable") |
no test coverage detected