summaryrefslogtreecommitdiff
path: root/http/middleware.go
diff options
context:
space:
mode:
Diffstat (limited to 'http/middleware.go')
-rw-r--r--http/middleware.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/http/middleware.go b/http/middleware.go
new file mode 100644
index 0000000..f2fe90d
--- /dev/null
+++ b/http/middleware.go
@@ -0,0 +1,16 @@
+package http
+
+import "net/http"
+
+func IsFormContentCheck(innerHandler http.Handler) http.Handler {
+ outerHandler := func(w http.ResponseWriter, r *http.Request) {
+ // TOdo:
+ contentType := r.Header.Get("Content-Type")
+ if contentType != "application/x-www-form-urlencoded" {
+ w.WriteHeader(http.StatusNotAcceptable)
+ return
+ }
+ innerHandler.ServeHTTP(w, r)
+ }
+ return http.HandlerFunc(outerHandler)
+}