codegangsta/martini-contrib — pull request #54 by nimajalali (2013-12-10 07:02:05+00:00)
Title: [render] Added AUTO method to select format automatically

I was constantly checking if the requester was asking for html or json. This reduces repeat code on my end, not sure if it falls in line with the vision for render. Thoughts?

```
package main

import (
"github.com/codegangsta/martini"
"github.com/codegangsta/martini-contrib/render"
)

func main() {
m := martini.Classic()
// render html templates from templates directory
m.Use(render.Renderer())

m.Get("/", func(r render.Render) {
r.AUTO(200, "hello", "jeremy")
})

m.Run()
}
```

If request contains parameter "format=html". Response will be as if ```r.HTML(200, "hello", "jeremy")``` was called.
Otherwise response will be as if ```r.JSON(200, "jeremy")``` was called.