diff options
Diffstat (limited to 'pkg/ext/mime.go')
-rw-r--r-- | pkg/ext/mime.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pkg/ext/mime.go b/pkg/ext/mime.go new file mode 100644 index 0000000..6da66e3 --- /dev/null +++ b/pkg/ext/mime.go @@ -0,0 +1,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) +} |