Fix push server internal http wiring

This commit is contained in:
Piotr Kozimor 2021-12-06 15:06:22 +01:00
parent b89da40cbd
commit c9e94b4751

View file

@ -54,22 +54,22 @@ func AddRoutes(r api.PushserverInternalAPI, internalAPIMux *mux.Router) {
}),
)
internalAPIMux.Handle(QueryPushRulesPath,
httputil.MakeInternalAPI("queryPushRules", func(req *http.Request) util.JSONResponse {
request := api.QueryPushRulesRequest{}
response := api.QueryPushRulesResponse{}
internalAPIMux.Handle(QueryPushersPath,
httputil.MakeInternalAPI("queryPushers", func(req *http.Request) util.JSONResponse {
request := api.QueryPushersRequest{}
response := api.QueryPushersResponse{}
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
return util.MessageResponse(http.StatusBadRequest, err.Error())
}
if err := r.QueryPushRules(req.Context(), &request, &response); err != nil {
if err := r.QueryPushers(req.Context(), &request, &response); err != nil {
return util.ErrorResponse(err)
}
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
}),
)
internalAPIMux.Handle(PerformPusherDeletionPath,
httputil.MakeInternalAPI("performPusherDeletion", func(req *http.Request) util.JSONResponse {
internalAPIMux.Handle(PerformPushRulesPutPath,
httputil.MakeInternalAPI("performPushRulesPut", func(req *http.Request) util.JSONResponse {
request := api.PerformPushRulesPutRequest{}
response := struct{}{}
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {