Dynamic Namespace

This commit is contained in:
Ben Toogood
2020-04-09 11:03:33 +01:00
parent 27eb7db1c2
commit 4ff959ef50
5 changed files with 31 additions and 9 deletions

View File

@@ -31,7 +31,14 @@ type Endpoint struct {
type Options struct {
Handler string
Namespace string
Namespace func(*http.Request) string
}
type Option func(o *Options)
// StaticNamespace returns the same namespace for each request
func StaticNamespace(ns string) func(*http.Request) string {
return func(*http.Request) string {
return ns
}
}