diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-07 19:33:07 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-07 19:33:07 +0200 |
commit | c7a8aa113a914e70e027fea93265c7232b865b5e (patch) | |
tree | d5514cb6e5f49838ff75e814b64652ad244cf0ef /pkg/ext/mime.go | |
parent | 18aa098f50e2a2c7db01dd4d04dde460fd40f5d5 (diff) | |
download | cerrado-c7a8aa113a914e70e027fea93265c7232b865b5e.tar.gz cerrado-c7a8aa113a914e70e027fea93265c7232b865b5e.tar.bz2 cerrado-c7a8aa113a914e70e027fea93265c7232b865b5e.zip |
feat: Add compression
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) +} |