code.gitea.io/gitea@v1.19.3/modules/web/middleware/request.go (about) 1 // Copyright 2020 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package middleware 5 6 import ( 7 "net/http" 8 "strings" 9 ) 10 11 // IsAPIPath returns true if the specified URL is an API path 12 func IsAPIPath(req *http.Request) bool { 13 return strings.HasPrefix(req.URL.Path, "/api/") 14 } 15 16 // IsInternalPath returns true if the specified URL is an internal API path 17 func IsInternalPath(req *http.Request) bool { 18 return strings.HasPrefix(req.URL.Path, "/api/internal/") 19 }