func()

in pkg/api/api.go [276:292]


func (h *APIHandler) History(w http.ResponseWriter, r *http.Request) {
	w.Header().Set(http.CanonicalHeaderKey("Content-Type"), "application/json")
	w.WriteHeader(http.StatusOK)

	h.historyMu.Lock()
	defer h.historyMu.Unlock()

	nonNilHist := make([]RequestRecord, 0)
	for _, v := range h.history {
		if v != nil {
			nonNilHist = append(nonNilHist, *v)
		}
	}

	json.NewEncoder(w).Encode(nonNilHist)
	return
}