RenderHTTPResponse either responds with json or a rendered html page using the passed in template by checking the Accepts header
(w http.ResponseWriter, v any, t *template.Template, r *http.Request)
| 165 | // RenderHTTPResponse either responds with json or a rendered html page using the passed in template |
| 166 | // by checking the Accepts header |
| 167 | func renderHTTPResponse(w http.ResponseWriter, v any, t *template.Template, r *http.Request) { |
| 168 | accept := r.Header.Get("Accept") |
| 169 | if strings.Contains(accept, "application/json") { |
| 170 | writeJSONResponse(w, v) |
| 171 | return |
| 172 | } |
| 173 | |
| 174 | w.Header().Set("Content-Type", "text/html") |
| 175 | if err := t.Execute(w, v); err != nil { |
| 176 | http.Error(w, err.Error(), http.StatusInternalServerError) |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | func (h *ringPageHandler) forget(ctx context.Context, id string) error { |
| 181 | unregister := func(in interface{}) (out interface{}, retry bool, err error) { |
no test coverage detected