1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-11 17:51:01 +00:00

Improve Request to be more idiomatic

This commit is contained in:
Frédéric Guillot 2017-11-21 18:14:45 -08:00
parent 4fc18647ca
commit 25cbd65777
20 changed files with 80 additions and 77 deletions

View file

@ -12,7 +12,7 @@ import (
// CreateCategory is the API handler to create a new category.
func (c *Controller) CreateCategory(ctx *core.Context, request *core.Request, response *core.Response) {
category, err := payload.DecodeCategoryPayload(request.GetBody())
category, err := payload.DecodeCategoryPayload(request.Body())
if err != nil {
response.Json().BadRequest(err)
return
@ -35,13 +35,13 @@ func (c *Controller) CreateCategory(ctx *core.Context, request *core.Request, re
// UpdateCategory is the API handler to update a category.
func (c *Controller) UpdateCategory(ctx *core.Context, request *core.Request, response *core.Response) {
categoryID, err := request.GetIntegerParam("categoryID")
categoryID, err := request.IntegerParam("categoryID")
if err != nil {
response.Json().BadRequest(err)
return
}
category, err := payload.DecodeCategoryPayload(request.GetBody())
category, err := payload.DecodeCategoryPayload(request.Body())
if err != nil {
response.Json().BadRequest(err)
return
@ -77,7 +77,7 @@ func (c *Controller) GetCategories(ctx *core.Context, request *core.Request, res
// RemoveCategory is the API handler to remove a category.
func (c *Controller) RemoveCategory(ctx *core.Context, request *core.Request, response *core.Response) {
userID := ctx.GetUserID()
categoryID, err := request.GetIntegerParam("categoryID")
categoryID, err := request.IntegerParam("categoryID")
if err != nil {
response.Json().BadRequest(err)
return