func ModelNegotiator() *negotiator.Negotiator { return negotiator.New( &HTMLTemplatePBResponseProcessor{}, &JSONPBResponseProcessor{}, &RawPBResponseProcessor{}, ) }
func negotiatormw(c *web.C, h http.Handler) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { c.Env["negotiator"] = negotiator.New(&responseprocessors.PlainTextResponseProcessor{}) h.ServeHTTP(w, r) } return http.HandlerFunc(fn) }
func customHandler(c web.C, w http.ResponseWriter, req *http.Request) error { user := &user{"Joe", "Bloggs"} //Creating the negotiator could be done for only required handlers or use middleware for all textplainNegotiator := negotiator.New(&responseprocessors.PlainTextResponseProcessor{}) return textplainNegotiator.Negotiate(w, req, user) }