1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-02 16:38:37 +00:00

Refactor HTTP response builder

This commit is contained in:
Frédéric Guillot 2018-10-07 18:42:43 -07:00
parent ddfe969d6c
commit 1f58b37a5e
94 changed files with 1701 additions and 644 deletions

View file

@ -18,11 +18,11 @@ func (c *Controller) Export(w http.ResponseWriter, r *http.Request) {
opmlHandler := opml.NewHandler(c.store)
opml, err := opmlHandler.Export(request.UserID(r))
if err != nil {
json.ServerError(w, err)
json.ServerError(w, r, err)
return
}
xml.OK(w, opml)
xml.OK(w, r, opml)
}
// Import is the API handler that import an OPML file.
@ -31,9 +31,9 @@ func (c *Controller) Import(w http.ResponseWriter, r *http.Request) {
err := opmlHandler.Import(request.UserID(r), r.Body)
defer r.Body.Close()
if err != nil {
json.ServerError(w, err)
json.ServerError(w, r, err)
return
}
json.Created(w, map[string]string{"message": "Feeds imported successfully"})
json.Created(w, r, map[string]string{"message": "Feeds imported successfully"})
}