We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 23418a6 commit 9b346bdCopy full SHA for 9b346bd
http.go
@@ -13,6 +13,7 @@ import (
13
"strings"
14
15
"golang.org/x/net/websocket"
16
+ "path/filepath"
17
)
18
19
// Request Revel's HTTP request object structure
@@ -78,6 +79,18 @@ func ResolveContentType(req *http.Request) string {
78
79
// returning a default of "html" when Accept header cannot be mapped to a
80
// value above.
81
func ResolveFormat(req *http.Request) string {
82
+ ext := strings.ToLower(filepath.Ext(req.URL.Path))
83
+ switch ext {
84
+ case ".html":
85
+ return "html"
86
+ case ".json":
87
+ return "json"
88
+ case ".xml":
89
+ return "xml"
90
+ case ".txt":
91
+ return "txt"
92
+ }
93
+
94
accept := req.Header.Get("accept")
95
96
switch {
0 commit comments