]> 127.0.0.1 Git - part/.git/commitdiff
add
authorqydysky <qydysky@foxmail.com>
Mon, 29 May 2023 14:12:36 +0000 (22:12 +0800)
committerqydysky <qydysky@foxmail.com>
Mon, 29 May 2023 14:12:36 +0000 (22:12 +0800)
web/Web.go

index 50ff8d1d5f8d05a2e1aba678dd6377dd3fbddf87..1670fe129c8d6d8cb1363fa61b858e2bf0ad4d60 100644 (file)
@@ -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()),