forked from mirror/gin
Fixed Content-Type for json render. Thank you @mdigger
This commit is contained in:
parent
5ea7a92267
commit
a1ff907768
|
@ -42,7 +42,7 @@ func writeHeader(w http.ResponseWriter, code int, contentType string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (_ jsonRender) Render(w http.ResponseWriter, code int, data ...interface{}) error {
|
func (_ jsonRender) Render(w http.ResponseWriter, code int, data ...interface{}) error {
|
||||||
writeHeader(w, code, "application/xml")
|
writeHeader(w, code, "application/json")
|
||||||
encoder := json.NewEncoder(w)
|
encoder := json.NewEncoder(w)
|
||||||
return encoder.Encode(data[0])
|
return encoder.Encode(data[0])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue