mirror of
https://github.com/miniflux/v2.git
synced 2025-08-06 17:41:00 +00:00
Improve Response to be more idiomatic
This commit is contained in:
parent
25cbd65777
commit
02ff7b4bcf
25 changed files with 302 additions and 275 deletions
|
@ -16,20 +16,20 @@ import (
|
|||
func (c *Controller) GetSubscriptions(ctx *core.Context, request *core.Request, response *core.Response) {
|
||||
websiteURL, err := payload.DecodeURLPayload(request.Body())
|
||||
if err != nil {
|
||||
response.Json().BadRequest(err)
|
||||
response.JSON().BadRequest(err)
|
||||
return
|
||||
}
|
||||
|
||||
subscriptions, err := subscription.FindSubscriptions(websiteURL)
|
||||
if err != nil {
|
||||
response.Json().ServerError(errors.New("Unable to discover subscriptions"))
|
||||
response.JSON().ServerError(errors.New("Unable to discover subscriptions"))
|
||||
return
|
||||
}
|
||||
|
||||
if subscriptions == nil {
|
||||
response.Json().NotFound(fmt.Errorf("No subscription found"))
|
||||
response.JSON().NotFound(fmt.Errorf("No subscription found"))
|
||||
return
|
||||
}
|
||||
|
||||
response.Json().Standard(subscriptions)
|
||||
response.JSON().Standard(subscriptions)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue