mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
Use vanilla HTTP handlers (refactoring)
This commit is contained in:
parent
1eba1730d1
commit
f49b42f70f
121 changed files with 4339 additions and 3369 deletions
23
http/response/xml/xml.go
Normal file
23
http/response/xml/xml.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2018 Frédéric Guillot. All rights reserved.
|
||||
// Use of this source code is governed by the Apache 2.0
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package xml
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// OK sends a XML document.
|
||||
func OK(w http.ResponseWriter, data string) {
|
||||
w.Header().Set("Content-Type", "text/xml")
|
||||
w.Write([]byte(data))
|
||||
}
|
||||
|
||||
// Attachment forces the download of a XML document.
|
||||
func Attachment(w http.ResponseWriter, filename, data string) {
|
||||
w.Header().Set("Content-Type", "text/xml")
|
||||
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%s", filename))
|
||||
w.Write([]byte(data))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue