xml.go 822 B

1234567891011121314151617181920212223
  1. // SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
  2. // SPDX-License-Identifier: Apache-2.0
  3. package response // import "miniflux.app/v2/internal/http/response"
  4. import "net/http"
  5. // XML writes a standard XML response with a status 200 OK.
  6. func XML(w http.ResponseWriter, r *http.Request, body string) {
  7. builder := NewBuilder(w, r)
  8. builder.WithHeader("Content-Type", "text/xml; charset=utf-8")
  9. builder.WithBodyAsString(body)
  10. builder.Write()
  11. }
  12. // XMLAttachment forces the XML document to be downloaded by the web browser.
  13. func XMLAttachment(w http.ResponseWriter, r *http.Request, filename string, body string) {
  14. builder := NewBuilder(w, r)
  15. builder.WithHeader("Content-Type", "text/xml; charset=utf-8")
  16. builder.WithAttachment(filename)
  17. builder.WithBodyAsString(body)
  18. builder.Write()
  19. }