mirror of
https://github.com/nais/wonderwall.git
synced 2026-02-14 17:49:54 +00:00
20 lines
434 B
Go
20 lines
434 B
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/nais/wonderwall/pkg/ingress"
|
|
mw "github.com/nais/wonderwall/pkg/middleware"
|
|
)
|
|
|
|
// GetPath returns the matching context path from the list of registered ingresses.
|
|
// If none match, an empty string is returned.
|
|
func GetPath(r *http.Request, ingresses *ingress.Ingresses) string {
|
|
path, ok := mw.PathFrom(r.Context())
|
|
if !ok {
|
|
path = ingresses.MatchingPath(r)
|
|
}
|
|
|
|
return path
|
|
}
|