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:
parent
25cbd65777
commit
02ff7b4bcf
25 changed files with 302 additions and 275 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue