예제 #1
0
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)
	}
}
예제 #2
0
// if you have a piece of middleware that you want to respond with
// return 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())
	})
}