handleUpdateCheck handles GET requests to check for updates
(w http.ResponseWriter, r *http.Request)
| 2916 | |
| 2917 | // handleUpdateCheck handles GET requests to check for updates |
| 2918 | func handleUpdateCheck(w http.ResponseWriter, r *http.Request) { |
| 2919 | if r.Method != "GET" { |
| 2920 | http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) |
| 2921 | return |
| 2922 | } |
| 2923 | |
| 2924 | status, err := checkForUpdate() |
| 2925 | if err != nil { |
| 2926 | http.Error(w, err.Error(), http.StatusInternalServerError) |
| 2927 | return |
| 2928 | } |
| 2929 | |
| 2930 | w.Header().Set("Content-Type", "application/json") |
| 2931 | json.NewEncoder(w).Encode(status) |
| 2932 | } |
| 2933 | |
| 2934 | // handleUpdatePerform handles POST requests to perform an update |
| 2935 | func handleUpdatePerform(w http.ResponseWriter, r *http.Request) { |
nothing calls this directly
no test coverage detected