summaryrefslogtreecommitdiffstats
path: root/modules/web/middleware/request.go
blob: 0bb155df70340fc18b1402028bc8caea35675299 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Copyright 2020 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package middleware

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/")
}