diff options
author | Frédéric Guillot <fred@miniflux.net> | 2017-11-21 18:30:16 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2017-11-21 18:30:16 -0800 |
commit | 02ff7b4bcf2b2c691e55ae61fe97bfd9ae37658e (patch) | |
tree | 236d95c147453fcdeacd92cdc17fd886d664c1b0 /server/core/xml_response.go | |
parent | 25cbd657771a67ef41abac4089a231369b96276e (diff) |
Improve Response to be more idiomatic
Diffstat (limited to 'server/core/xml_response.go')
-rw-r--r-- | server/core/xml_response.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/core/xml_response.go b/server/core/xml_response.go index 6ffd5c9..e9a2d3f 100644 --- a/server/core/xml_response.go +++ b/server/core/xml_response.go @@ -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)) |