MCPcopy
hub / github.com/gin-gonic/gin / Render

Method Render

render/data.go:19–26  ·  view source on GitHub ↗

Render (Data) writes data with custom ContentType.

(w http.ResponseWriter)

Source from the content-addressed store, hash-verified

17
18// Render (Data) writes data with custom ContentType.
19func (r Data) Render(w http.ResponseWriter) (err error) {
20 r.WriteContentType(w)
21 if len(r.Data) > 0 {
22 w.Header().Set("Content-Length", strconv.Itoa(len(r.Data)))
23 }
24 _, err = w.Write(r.Data)
25 return
26}
27
28// WriteContentType (Data) writes custom ContentType.
29func (r Data) WriteContentType(w http.ResponseWriter) {

Callers 1

Calls 4

WriteContentTypeMethod · 0.95
SetMethod · 0.80
HeaderMethod · 0.45
WriteMethod · 0.45

Tested by 1