From e6d7e091b7b6dde1c736e7baf01fad5fd5c1ce27 Mon Sep 17 00:00:00 2001 From: uvok cheetah Date: Fri, 8 Dec 2023 17:05:40 +0000 Subject: Initial Commit --- http/middleware.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 http/middleware.go (limited to 'http/middleware.go') 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) +} -- cgit v1.2.3