diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-10-07 18:42:43 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-10-08 15:31:58 -0700 |
commit | 1f58b37a5e86603b16e137031c36f37580e9d410 (patch) | |
tree | 337a7299e91fe7640b64489357dfe7c0f00e2313 /api/opml.go | |
parent | ddfe969d6cbc8d23326cb9a3ca9a265d4e9d3e45 (diff) |
Refactor HTTP response builder
Diffstat (limited to 'api/opml.go')
-rw-r--r-- | api/opml.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/api/opml.go b/api/opml.go index eb214f3..199c0e7 100644 --- a/api/opml.go +++ b/api/opml.go @@ -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"}) } |