Skip to content
Myr

Merge pull request #76 from mopemope/fix-plainrender

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix Corrupted plainRender

authored by Manu Mtz.-Almeida · committed by Manu Mtz.-Almeida · parents cc94aa2, 2947981 · Browse files · 1 file+6 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−1 removed

  • other:+6 added−1 removed

1 file+6 added−1 removed

modified:render/render.go+6 added-1 removed
62 unmodified lines
63func (_ plainRender) Render(w http.ResponseWriter, code int, data ...interface{}) error {64 writeHeader(w, code, "text/plain")65 format := data[0].(string)66 args := data[1].([]interface{})67 _, err := w.Write([]byte(fmt.Sprintf(format, args)))67 var err error68 if len(args) > 0 {69 _, err = w.Write([]byte(fmt.Sprintf(format, args...)))70 } else {71 _, err = w.Write([]byte(format))72 }73 return err74}