mirror of
https://github.com/miniflux/v2.git
synced 2025-08-06 17:41:00 +00:00
Refactor category validation
This commit is contained in:
parent
e45cc2d2aa
commit
4468ef1410
13 changed files with 122 additions and 212 deletions
|
@ -182,19 +182,3 @@ func decodeEntryStatusRequest(r io.ReadCloser) ([]int64, string, error) {
|
|||
|
||||
return p.EntryIDs, p.Status, nil
|
||||
}
|
||||
|
||||
type categoryRequest struct {
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
func decodeCategoryRequest(r io.ReadCloser) (*categoryRequest, error) {
|
||||
var payload categoryRequest
|
||||
|
||||
decoder := json.NewDecoder(r)
|
||||
defer r.Close()
|
||||
if err := decoder.Decode(&payload); err != nil {
|
||||
return nil, fmt.Errorf("Unable to decode JSON object: %v", err)
|
||||
}
|
||||
|
||||
return &payload, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue