From 0a8d34df14b2d5a37760b3de35126d4b24ea1093 Mon Sep 17 00:00:00 2001 From: qydysky Date: Mon, 29 May 2023 22:12:36 +0800 Subject: [PATCH] add --- web/Web.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/Web.go b/web/Web.go index 50ff8d1..1670fe1 100644 --- a/web/Web.go +++ b/web/Web.go @@ -349,6 +349,15 @@ func WithStatusCode(w http.ResponseWriter, code int) { _, _ = w.Write([]byte(http.StatusText(code))) } +func IsMethod(r *http.Request, method ...string) bool { + for i := 0; i < len(method); i++ { + if r.Method == method[i] { + return true + } + } + return false +} + func Easy_boot() *Web { s := New(&http.Server{ Addr: "127.0.0.1:" + strconv.Itoa(sys.Sys().GetFreePort()), -- 2.39.2