reprogl
1package handlers2
3import (4"fmt"5"net/http"6
7"xelbot.com/reprogl/container"8)
9
10func PurgeCache(app *container.Application) http.HandlerFunc {11return func(w http.ResponseWriter, r *http.Request) {12app.GetIntCache().Clear()13app.InfoLog.Println("[CACHE] integer cache was cleared")14
15app.GetStringCache().Clear()16app.InfoLog.Println("[CACHE] string cache was cleared")17
18w.Header().Set("Content-Type", "text/plain")19w.Write([]byte("Cache was cleared\n"))20}21}
22
23func HeadersDebug(w http.ResponseWriter, r *http.Request) {24var body string25for name, values := range r.Header {26for _, value := range values {27body += fmt.Sprintf("%s: %s\n", name, value)28}29}30
31w.Header().Set("Content-Type", "text/plain")32w.Write([]byte(body))33}
34