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

Method Render

render/yaml.go:21–31  ·  view source on GitHub ↗

Render (YAML) marshals the given interface object and writes data with custom ContentType.

(w http.ResponseWriter)

Source from the content-addressed store, hash-verified

19
20// Render (YAML) marshals the given interface object and writes data with custom ContentType.
21func (r YAML) Render(w http.ResponseWriter) error {
22 r.WriteContentType(w)
23
24 bytes, err := yaml.Marshal(r.Data)
25 if err != nil {
26 return err
27 }
28
29 _, err = w.Write(bytes)
30 return err
31}
32
33// WriteContentType (YAML) writes YAML ContentType for response.
34func (r YAML) WriteContentType(w http.ResponseWriter) {

Callers

nothing calls this directly

Calls 3

WriteContentTypeMethod · 0.95
MarshalMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected