aboutsummaryrefslogtreecommitdiff
path: root/pkg/ext/mime.go
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-06-07 19:33:07 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-06-07 19:33:07 +0200
commitc7a8aa113a914e70e027fea93265c7232b865b5e (patch)
treed5514cb6e5f49838ff75e814b64652ad244cf0ef /pkg/ext/mime.go
parent18aa098f50e2a2c7db01dd4d04dde460fd40f5d5 (diff)
downloadcerrado-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.go24
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)
+}