diff --git a/registry.go b/registry.go index e36ef6bf..7e37bff2 100644 --- a/registry.go +++ b/registry.go @@ -14,7 +14,9 @@ func (r *Registry) Add(f Factory) { } // Build constructs a single Interceptor from a InterceptorRegistry -func (r *Registry) Build(id string) (Interceptor, error) { +// The extra interceptors are added to the chain after the ones specified +// by the registry. +func (r *Registry) Build(id string, extra... Interceptor) (Interceptor, error) { if len(r.factories) == 0 { return &NoOp{}, nil } @@ -29,5 +31,7 @@ func (r *Registry) Build(id string) (Interceptor, error) { interceptors = append(interceptors, i) } + interceptors = append(interceptors, extra...) + return NewChain(interceptors), nil }