aboutsummaryrefslogtreecommitdiff
path: root/pkg/ext/mime.go
blob: 6da66e3db03709439e1a8731116081dd5fe738bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package ext

import "net/http"

type ContentType = string

const (
	TextHTML ContentType = "text/html"
)

func Html(next func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		next(w, r)
	}
}

func SetHTML(w http.ResponseWriter) {
	SetMIME(w, TextHTML)

}

func SetMIME(w http.ResponseWriter, mime ContentType) {
	w.Header().Add("Content-Type", mime)
}