func (this splitter) Run(vars map[string]interface{}, next func()) {
	var result rack.Middleware
	switch (httper.V)(vars).GetRequest().Method {
	case "GET":
		result = this.get
	case "POST":
		result = this.post
	case "PUT":
		result = this.put
	case "DELETE":
		result = this.delete
	default:
		(httper.V)(vars).Status(http.StatusBadRequest)
	}
	if result == nil {
		//that particular method wasn't set, but perhaps a later middleware will take care of it
		next()
	} else {
		result.Run(vars, next)
	}
}
Example #2
0
//FinishWithMiddleware() replaces the default finish with any other middleware you might have on hand.
// if you have a piece of middleware that you want to respond with
// call this instead of Finish along with the middleware you want to run
func (this Heart) FinishWithMiddleware(m rack.Middleware) {
	this.finishingFunc(func() {
		m.Run(this.getRackFuncVars())
	})
}