2021-01-27 23:16:35 +05:30
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
2022-11-27 23:50:29 +05:30
|
|
|
// SPDX-License-Identifier: MIT
|
2021-01-27 23:16:35 +05:30
|
|
|
|
2021-01-30 14:25:53 +05:30
|
|
|
package middleware
|
2021-01-27 23:16:35 +05:30
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
// IsAPIPath returns true if the specified URL is an API path
|
|
|
|
func IsAPIPath(req *http.Request) bool {
|
|
|
|
return strings.HasPrefix(req.URL.Path, "/api/")
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsInternalPath returns true if the specified URL is an internal API path
|
|
|
|
func IsInternalPath(req *http.Request) bool {
|
|
|
|
return strings.HasPrefix(req.URL.Path, "/api/internal/")
|
|
|
|
}
|