...
1
2
3
4
5 package render
6
7 import "net/http"
8
9
10 type Render interface {
11
12 Render(http.ResponseWriter) error
13
14 WriteContentType(w http.ResponseWriter)
15 }
16
17 var (
18 _ Render = JSON{}
19 _ Render = IndentedJSON{}
20 _ Render = SecureJSON{}
21 _ Render = JsonpJSON{}
22 _ Render = XML{}
23 _ Render = String{}
24 _ Render = Redirect{}
25 _ Render = Data{}
26 _ Render = HTML{}
27 _ HTMLRender = HTMLDebug{}
28 _ HTMLRender = HTMLProduction{}
29 _ Render = YAML{}
30 _ Render = Reader{}
31 _ Render = AsciiJSON{}
32 _ Render = ProtoBuf{}
33 _ Render = TOML{}
34 )
35
36 func writeContentType(w http.ResponseWriter, value []string) {
37 header := w.Header()
38 if val := header["Content-Type"]; len(val) == 0 {
39 header["Content-Type"] = value
40 }
41 }
42
View as plain text