middleware.go
func (ms *MiddlewareStack) Replace(mw1 MiddlewareFunc, mw2 MiddlewareFunc) {
	m1k := funcKey(mw1)
	stack := []MiddlewareFunc{}
	for _, mw := range ms.stack {
		if funcKey(mw) == m1k {
			stack = append(stack, mw2)
		} else {
			stack = append(stack, mw)
		}
	}
	ms.stack = stack
}
func (ms *MiddlewareStack) Replace(mw1 MiddlewareFunc, mw2 MiddlewareFunc) {
	m1k := funcKey(mw1)
	stack := []MiddlewareFunc{}
	for _, mw := range ms.stack {
		if funcKey(mw) == m1k {
			stack = append(stack, mw2)
		} else {
			stack = append(stack, mw)
		}
	}
	ms.stack = stack
}
func ( ms * MiddlewareStack ) Replace ( mw1 MiddlewareFunc , mw2 MiddlewareFunc ) { m1k := funcKey ( mw1 ) stack := [ ] MiddlewareFunc { } for _ , mw := range ms . stack { if funcKey ( mw ) == m1k { stack = append ( stack , mw2 ) } else { stack = append ( stack , mw ) } } ms . stack = stack }
// Replace a piece of middleware with another piece of middleware. Great for
// testing.
Replace a piece of middleware with another piece of middleware . Great for testing .