From 794d302ce59916a5afddb2b41e059b883e7ccb07 Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Tue, 16 Apr 2019 12:11:12 +0300 Subject: [PATCH 1/2] * control: replace ensurePUT and ensureDELETE with ensurePOST --- control.go | 6 +++--- helpers.go | 8 -------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/control.go b/control.go index ba7b1838..328298bd 100644 --- a/control.go +++ b/control.go @@ -1115,13 +1115,13 @@ func registerControlHandlers() { http.HandleFunc("/control/version.json", postInstall(optionalAuth(handleGetVersionJSON))) http.HandleFunc("/control/filtering/enable", postInstall(optionalAuth(ensurePOST(handleFilteringEnable)))) http.HandleFunc("/control/filtering/disable", postInstall(optionalAuth(ensurePOST(handleFilteringDisable)))) - http.HandleFunc("/control/filtering/add_url", postInstall(optionalAuth(ensurePUT(handleFilteringAddURL)))) - http.HandleFunc("/control/filtering/remove_url", postInstall(optionalAuth(ensureDELETE(handleFilteringRemoveURL)))) + http.HandleFunc("/control/filtering/add_url", postInstall(optionalAuth(ensurePOST(handleFilteringAddURL)))) + http.HandleFunc("/control/filtering/remove_url", postInstall(optionalAuth(ensurePOST(handleFilteringRemoveURL)))) http.HandleFunc("/control/filtering/enable_url", postInstall(optionalAuth(ensurePOST(handleFilteringEnableURL)))) http.HandleFunc("/control/filtering/disable_url", postInstall(optionalAuth(ensurePOST(handleFilteringDisableURL)))) http.HandleFunc("/control/filtering/refresh", postInstall(optionalAuth(ensurePOST(handleFilteringRefresh)))) http.HandleFunc("/control/filtering/status", postInstall(optionalAuth(ensureGET(handleFilteringStatus)))) - http.HandleFunc("/control/filtering/set_rules", postInstall(optionalAuth(ensurePUT(handleFilteringSetRules)))) + http.HandleFunc("/control/filtering/set_rules", postInstall(optionalAuth(ensurePOST(handleFilteringSetRules)))) http.HandleFunc("/control/safebrowsing/enable", postInstall(optionalAuth(ensurePOST(handleSafeBrowsingEnable)))) http.HandleFunc("/control/safebrowsing/disable", postInstall(optionalAuth(ensurePOST(handleSafeBrowsingDisable)))) http.HandleFunc("/control/safebrowsing/status", postInstall(optionalAuth(ensureGET(handleSafeBrowsingStatus)))) diff --git a/helpers.go b/helpers.go index b0bd3754..a304634e 100644 --- a/helpers.go +++ b/helpers.go @@ -60,14 +60,6 @@ func ensureGETHandler(handler func(http.ResponseWriter, *http.Request)) http.Han return &h } -func ensurePUT(handler func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) { - return ensure("PUT", handler) -} - -func ensureDELETE(handler func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) { - return ensure("DELETE", handler) -} - func optionalAuth(handler func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) { return func(w http.ResponseWriter, r *http.Request) { if config.AuthName == "" || config.AuthPass == "" { From d0942c88c8968b7e410356b1ae89ec7d3e69f2bb Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Tue, 16 Apr 2019 12:11:31 +0300 Subject: [PATCH 2/2] * client: replace PUT and DELETE with POST --- client/src/api/Api.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/api/Api.js b/client/src/api/Api.js index e16a419e..a0ca7ed2 100644 --- a/client/src/api/Api.js +++ b/client/src/api/Api.js @@ -149,9 +149,9 @@ export default class Api { FILTERING_STATUS = { path: 'filtering/status', method: 'GET' }; FILTERING_ENABLE = { path: 'filtering/enable', method: 'POST' }; FILTERING_DISABLE = { path: 'filtering/disable', method: 'POST' }; - FILTERING_ADD_FILTER = { path: 'filtering/add_url', method: 'PUT' }; - FILTERING_REMOVE_FILTER = { path: 'filtering/remove_url', method: 'DELETE' }; - FILTERING_SET_RULES = { path: 'filtering/set_rules', method: 'PUT' }; + FILTERING_ADD_FILTER = { path: 'filtering/add_url', method: 'POST' }; + FILTERING_REMOVE_FILTER = { path: 'filtering/remove_url', method: 'POST' }; + FILTERING_SET_RULES = { path: 'filtering/set_rules', method: 'POST' }; FILTERING_ENABLE_FILTER = { path: 'filtering/enable_url', method: 'POST' }; FILTERING_DISABLE_FILTER = { path: 'filtering/disable_url', method: 'POST' }; FILTERING_REFRESH = { path: 'filtering/refresh', method: 'POST' };