Skip to content
Myr

render.go

This file

Path

render/render.go

41 lines · 1.1 KiB · Go

Last changed by

chore: update go.mod and remove space from copyright (#3158)thinkeroubefore adoption4b68a5f

History of this file

Take it

The walk stopped after 200 commits: lines older than a550c56 point at it.

chore: update go.mod and remove space from copyright (#3158)thinkeroubefore adoption4b68a5f

line 1why, one step back
1// Copyright 2014 Manu Martinez-Almeida. All rights reserved.

chore: Add go1.17 for testing (#2828)Bo-Yi Wubefore adoptiona550c56

lines 2–32why, one step back
2// Use of this source code is governed by a MIT style
3// license that can be found in the LICENSE file.45package render67import "net/http"89// Render interface is to be implemented by JSON, XML, HTML, YAML and so on.10type Render interface {11 // Render writes data with custom ContentType.12 Render(http.ResponseWriter) error13 // WriteContentType writes custom ContentType.14 WriteContentType(w http.ResponseWriter)15}1617var (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{}

[GIN-001] - Add TOML bining for gin (#3081)Valentine Oragbakosibefore adoptioned03102

line 33why, one step back
33 _ Render = TOML{}

chore: Add go1.17 for testing (#2828)Bo-Yi Wubefore adoptiona550c56

lines 34–41why, one step back
34)
3536func writeContentType(w http.ResponseWriter, value []string) {37 header := w.Header()38 if val := header["Content-Type"]; len(val) == 0 {39 header["Content-Type"] = value40 }41}