xml.go 758 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. NewBuilder(w, r).
  8. WithHeader("Content-Type", "text/xml; charset=utf-8").
  9. WithBodyAsString(body).
  10. 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. NewBuilder(w, r).
  15. WithHeader("Content-Type", "text/xml; charset=utf-8").
  16. WithAttachment(filename).
  17. WithBodyAsString(body).
  18. Write()
  19. }