podman

Форк
0
28 строк · 730.0 Байт
1
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2
// Use of this source code is governed by a MIT style
3
// license that can be found in the LICENSE file.
4

5
package render
6

7
import (
8
	"encoding/xml"
9
	"net/http"
10
)
11

12
// XML contains the given interface object.
13
type XML struct {
14
	Data any
15
}
16

17
var xmlContentType = []string{"application/xml; charset=utf-8"}
18

19
// Render (XML) encodes the given interface object and writes data with custom ContentType.
20
func (r XML) Render(w http.ResponseWriter) error {
21
	r.WriteContentType(w)
22
	return xml.NewEncoder(w).Encode(r.Data)
23
}
24

25
// WriteContentType (XML) writes XML ContentType for response.
26
func (r XML) WriteContentType(w http.ResponseWriter) {
27
	writeContentType(w, xmlContentType)
28
}
29

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.