removed unnecessary type conversion and now using append in chain.Append
diff --git a/chain.go b/chain.go
index c75f9c9..58a7a51 100644
--- a/chain.go
+++ b/chain.go
@@ -66,7 +66,7 @@
if fn == nil {
return c.Then(nil)
}
- return c.Then(http.HandlerFunc(fn))
+ return c.Then(fn)
}
// Append extends a chain, adding the specified constructors
@@ -79,9 +79,9 @@
// // requests in stdChain go m1 -> m2
// // requests in extChain go m1 -> m2 -> m3 -> m4
func (c Chain) Append(constructors ...Constructor) Chain {
- newCons := make([]Constructor, len(c.constructors)+len(constructors))
- copy(newCons, c.constructors)
- copy(newCons[len(c.constructors):], constructors)
+ newCons := make([]Constructor, 0, len(c.constructors)+len(constructors))
+ newCons = append(newCons, c.constructors...)
+ newCons = append(newCons, constructors...)
return New(newCons...)
}