diff --git a/.travis.yml b/.travis.yml index e547497b..1db82709 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,8 +40,6 @@ before_deploy: after_deploy: - if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then make publish-homebrew; fi - - snapcraft login --with "$SNAP_TOKEN" - - if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then make snapcraft; fi deploy: - provider: releases diff --git a/handlers/api.go b/handlers/api.go index ea96de7d..f0a1fd0f 100644 --- a/handlers/api.go +++ b/handlers/api.go @@ -68,6 +68,7 @@ func sendErrorJson(err error, w http.ResponseWriter, r *http.Request) { Status: "error", Error: err.Error(), } + r.Body.Close() w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(output) } @@ -117,6 +118,7 @@ func sendJsonAction(obj interface{}, method string, w http.ResponseWriter, r *ht Output: obj, } + r.Body.Close() w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(output) } diff --git a/handlers/routes.go b/handlers/routes.go index b10e2fbb..fff71b9b 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -81,7 +81,6 @@ func Router() *mux.Router { // SERVICE Routes r.Handle("/services", http.HandlerFunc(servicesHandler)).Methods("GET") - r.Handle("/services/reorder", http.HandlerFunc(reorderServiceHandler)).Methods("POST") r.Handle("/service/{id}", http.HandlerFunc(servicesViewHandler)).Methods("GET") r.Handle("/service/{id}/edit", http.HandlerFunc(servicesViewHandler)) r.Handle("/service/{id}/delete_failures", http.HandlerFunc(servicesDeleteFailuresHandler)).Methods("GET") @@ -94,6 +93,7 @@ func Router() *mux.Router { r.Handle("/api/services", http.HandlerFunc(apiAllServicesHandler)).Methods("GET") r.Handle("/api/services", http.HandlerFunc(apiCreateServiceHandler)).Methods("POST") r.Handle("/api/services/{id}", http.HandlerFunc(apiServiceHandler)).Methods("GET") + r.Handle("/api/services/reorder", http.HandlerFunc(reorderServiceHandler)).Methods("POST") r.Handle("/api/services/{id}/data", cached("120s", "application/json", http.HandlerFunc(apiServiceDataHandler))).Methods("GET") r.Handle("/api/services/{id}/ping", http.HandlerFunc(apiServicePingDataHandler)).Methods("GET") r.Handle("/api/services/{id}", http.HandlerFunc(apiServiceUpdateHandler)).Methods("POST") diff --git a/source/tmpl/services.html b/source/tmpl/services.html index 57cb2580..e00835e4 100644 --- a/source/tmpl/services.html +++ b/source/tmpl/services.html @@ -61,14 +61,12 @@ newOrder.push(o); }); $.ajax({ - url: "/services/reorder", + url: "/api/services/reorder", type: 'POST', data: JSON.stringify(newOrder), contentType: "application/json", dataType: "json", - success: function(data) { - console.log(data) - } + success: function(data) { } }); });