rest/if.go
func (mw *IfMiddleware) MiddlewareFunc(h HandlerFunc) HandlerFunc {

	if mw.Condition == nil {
		log.Fatal("IfMiddleware Condition is required")
	}

	var ifTrueHandler HandlerFunc
	if mw.IfTrue != nil {
		ifTrueHandler = mw.IfTrue.MiddlewareFunc(h)
	} else {
		ifTrueHandler = h
	}

	var ifFalseHandler HandlerFunc
	if mw.IfFalse != nil {
		ifFalseHandler = mw.IfFalse.MiddlewareFunc(h)
	} else {
		ifFalseHandler = h
	}

	return func(w ResponseWriter, r *Request) {

		if mw.Condition(r) {
			ifTrueHandler(w, r)
		} else {
			ifFalseHandler(w, r)
		}

	}
}
func (mw *IfMiddleware) MiddlewareFunc(h HandlerFunc) HandlerFunc {

	if mw.Condition == nil {
		log.Fatal("IfMiddleware Condition is required")
	}

	var ifTrueHandler HandlerFunc
	if mw.IfTrue != nil {
		ifTrueHandler = mw.IfTrue.MiddlewareFunc(h)
	} else {
		ifTrueHandler = h
	}

	var ifFalseHandler HandlerFunc
	if mw.IfFalse != nil {
		ifFalseHandler = mw.IfFalse.MiddlewareFunc(h)
	} else {
		ifFalseHandler = h
	}

	return func(w ResponseWriter, r *Request) {

		if mw.Condition(r) {
			ifTrueHandler(w, r)
		} else {
			ifFalseHandler(w, r)
		}

	}
}
// MiddlewareFunc makes TimerMiddleware implement the Middleware interface.