mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
32 lines
706 B
Go
32 lines
706 B
Go
|
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.
|
||
|
// Use of this source code is governed by a MIT style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
|
package render
|
||
|
|
||
|
import "net/http"
|
||
|
|
||
|
type Render interface {
|
||
|
Render(http.ResponseWriter) error
|
||
|
}
|
||
|
|
||
|
var (
|
||
|
_ Render = JSON{}
|
||
|
_ Render = IndentedJSON{}
|
||
|
_ Render = XML{}
|
||
|
_ Render = String{}
|
||
|
_ Render = Redirect{}
|
||
|
_ Render = Data{}
|
||
|
_ Render = HTML{}
|
||
|
_ HTMLRender = HTMLDebug{}
|
||
|
_ HTMLRender = HTMLProduction{}
|
||
|
_ Render = YAML{}
|
||
|
)
|
||
|
|
||
|
func writeContentType(w http.ResponseWriter, value []string) {
|
||
|
header := w.Header()
|
||
|
if val := header["Content-Type"]; len(val) == 0 {
|
||
|
header["Content-Type"] = value
|
||
|
}
|
||
|
}
|