mirror of
https://github.com/documize/community.git
synced 2025-07-24 15:49:44 +02:00
Fix regression for robots.txt and sitemap.xml
This commit is contained in:
parent
e0e3f0c141
commit
6993dc678f
2 changed files with 18 additions and 4 deletions
|
@ -48,8 +48,8 @@ func WriteServerError(w http.ResponseWriter, method string, err error) {
|
|||
|
||||
// WriteError notifies HTTP client of general application error.
|
||||
func WriteError(w http.ResponseWriter, method string) {
|
||||
writeStatus(w, http.StatusBadRequest)
|
||||
w.Write([]byte("{Error: 'Internal server error'}"))
|
||||
writeStatus(w, http.StatusBadRequest)
|
||||
w.Write([]byte("{Error: 'Internal server error'}"))
|
||||
}
|
||||
|
||||
// WriteDuplicateError notifies HTTP client of duplicate data that has been rejected.
|
||||
|
@ -114,3 +114,17 @@ func WriteJSON(w http.ResponseWriter, v interface{}) {
|
|||
j, _ := json.Marshal(v)
|
||||
w.Write(j)
|
||||
}
|
||||
|
||||
// WriteText to HTTP response
|
||||
func WriteText(w http.ResponseWriter, data []byte) {
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write(data)
|
||||
}
|
||||
|
||||
// WriteXML to HTTP response
|
||||
func WriteXML(w http.ResponseWriter, data []byte) {
|
||||
w.Header().Set("Content-Type", "application/xml; charset=utf-8")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write(data)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue