Experimental server side wrappers for handlers

This commit is contained in:
Asim
2015-12-02 00:47:52 +00:00
parent 0c9f8411bb
commit dae745f30f
4 changed files with 61 additions and 42 deletions

View File

@@ -18,6 +18,7 @@ type options struct {
advertise string
id string
version string
wrappers []Wrapper
}
func newOptions(opt ...Option) options {
@@ -153,3 +154,10 @@ func Metadata(md map[string]string) Option {
o.metadata = md
}
}
// Adds a handler Wrapper to a list of options passed into the server
func Wrap(w Wrapper) Option {
return func(o *options) {
o.wrappers = append(o.wrappers, w)
}
}