Documentation
¶
Overview ¶
Package router provides a simple HTTP router with wildcard path suffix matching.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is a simple HTTP request router that matches requests based on HTTP method and path suffix patterns with wildcard support.
func (*Router) Fallback ¶
Fallback registers a handler for all other requests that don't match specific routes.
func (*Router) GetInfoRefs ¶
GetInfoRefs registers a handler for GET requests ending with /info/refs. This matches patterns like: /repo/path/info/refs, /any/path/info/refs, etc.
func (*Router) PostGitUploadPack ¶
PostGitUploadPack registers a handler for POST requests ending with /git-upload-pack. This matches patterns like: /repo/path/git-upload-pack, /any/path/git-upload-pack, etc.
func (*Router) ServeHTTP ¶
func (rt *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface. It routes requests based on HTTP method and path suffix patterns.
Note: Protocol validation (Git Protocol v2) should be applied via middleware and is not enforced by the router itself. This allows the router to be used for both Git protocol routes (which require protocol headers) and API routes (which don't).