fix: rule provider http api crash

This commit is contained in:
Skyxim 2022-04-28 09:44:29 +08:00
parent c161d5e6be
commit 22c1e05e1c

View File

@ -94,8 +94,8 @@ func getRuleProviders(w http.ResponseWriter, r *http.Request) {
}
func updateRuleProvider(w http.ResponseWriter, r *http.Request) {
provider := r.Context().Value(CtxKeyProvider).(*provider.RuleProvider)
if err := (*provider).Update(); err != nil {
provider := r.Context().Value(CtxKeyProvider).(provider.RuleProvider)
if err := provider.Update(); err != nil {
render.Status(r, http.StatusServiceUnavailable)
render.JSON(w, r, newError(err.Error()))
}