code: func ResolveFormat(req *Request) string {
  	ext := strings.ToLower(filepath.Ext(req.GetPath()))
  	switch ext {
  	case ".html":
  		return "html"
  	case ".json":
  		return "json"
  	case ".xml":
  		return "xml"
  	case ".txt":
  		return "txt"
  	}
  
  	accept := req.GetHttpHeader("accept")
  
  	switch {
  	case accept == "",
  		strings.HasPrefix(accept, "*/*"), // */
  		strings.Contains(accept, "application/xhtml"),
  		strings.Contains(accept, "text/html"):
  		return "html"
  	case strings.Contains(accept, "application/json"),
  		strings.Contains(accept, "text/javascript"),
  		strings.Contains(accept, "application/javascript"):
  		return "json"
  	case strings.Contains(accept, "application/xml"),
  		strings.Contains(accept, "text/xml"):
  		return "xml"
  	case strings.Contains(accept, "text/plain"):
  		return "txt"
  	}
  
  	return "html"
  }
docs: // ResolveFormat maps the request's Accept MIME type declaration to
  // a Request.Format attribute, specifically "html", "xml", "json", or "txt",
  // returning a default of "html" when Accept header cannot be mapped to a
  // value above.