From: qydysky Date: Mon, 29 May 2023 14:12:36 +0000 (+0800) Subject: add X-Git-Tag: v0.28.0+20230529d4a6f98~4 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=0a8d34df14b2d5a37760b3de35126d4b24ea1093;p=part%2F.git add --- 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()),