Skip to content

Instantly share code, notes, and snippets.

@icambridge
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icambridge/11321687 to your computer and use it in GitHub Desktop.
Save icambridge/11321687 to your computer and use it in GitHub Desktop.
Force template format
c.Request.Format = "json"
package controllers
import "github.com/revel/revel"
type Test struct {
*revel.Controller
}
func (c Test) List() revel.Result {
c.Request.Format = "json"
return c.Render()
}
@icambridge
Copy link
Author

This would result in views/test/list.json being used as the template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment