cerrado @ e1664fcbc4685906d3dabc66bf947a17bce7efc0

 1package ext
 2
 3import "net/http"
 4
 5type ContentType = string
 6
 7const (
 8	TextHTML        ContentType = "text/html"
 9	ApplicationGZip ContentType = "application/gzip"
10)
11
12func Html(next func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {
13	return func(w http.ResponseWriter, r *http.Request) {
14		next(w, r)
15	}
16}
17
18func SetFileName(w http.ResponseWriter, name string) {
19	h := "inline; filename=\"" + name + "\""
20	w.Header().Add("Content-Disposition", h)
21}
22
23func SetHTML(w http.ResponseWriter) {
24	SetMIME(w, TextHTML)
25}
26
27func SetGZip(w http.ResponseWriter) {
28	SetMIME(w, ApplicationGZip)
29}
30
31func SetMIME(w http.ResponseWriter, mime ContentType) {
32	w.Header().Add("Content-Type", mime)
33}