/
githubmirror
/
gin
Обзор
Документация
Войти
/
githubmirror
/
gin
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v1.0
render/xml.go
21 строка
459 B
Manu Mtz-Almeida
Add support for custom HTML and XML content-type
13 июн 2015, 05:43
13 июн 2015, 05:43
352868e
Код
Авторство
О чём код?
// 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 ( "encoding/xml" "net/http" ) type XML struct { Data interface{} } var xmlContentType = []string{"application/xml; charset=utf-8"} func (r XML) Render(w http.ResponseWriter) error { writeContentType(w, xmlContentType) return xml.NewEncoder(w).Encode(r.Data) }