1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-22 17:18:37 +00:00

Improve Response to be more idiomatic

This commit is contained in:
Frédéric Guillot 2017-11-21 18:30:16 -08:00
parent 25cbd65777
commit 02ff7b4bcf
25 changed files with 302 additions and 275 deletions

View file

@ -9,12 +9,14 @@ import (
"net/http"
)
type XmlResponse struct {
// XMLResponse handles XML responses.
type XMLResponse struct {
writer http.ResponseWriter
request *http.Request
}
func (x *XmlResponse) Download(filename, data string) {
// Download force the download of a XML document.
func (x *XMLResponse) Download(filename, data string) {
x.writer.Header().Set("Content-Type", "text/xml")
x.writer.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%s", filename))
x.writer.Write([]byte(data))