diff options
author | uvok cheetah | 2023-12-08 17:05:40 +0000 |
---|---|---|
committer | uvok cheetah | 2023-12-08 17:05:40 +0000 |
commit | e6d7e091b7b6dde1c736e7baf01fad5fd5c1ce27 (patch) | |
tree | 38a11d4df6a3661ba9eec8d0e7c7df0d9116a19d /http/middleware.go |
Initial Commit
Diffstat (limited to 'http/middleware.go')
-rw-r--r-- | http/middleware.go | 16 |
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) +} |