mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-11 03:11:50 +00:00
Return an empty array if no tasks are available
All other api endpoints also send empty arrays instead of nil. Closes #1123
This commit is contained in:
@@ -71,5 +71,5 @@ func (s *TaskSuite) TestTasksClear(c *C) {
|
||||
c.Check(response.Code, Equals, 200)
|
||||
response, _ = s.HTTPRequest("GET", "/api/tasks", nil)
|
||||
c.Check(response.Code, Equals, 200)
|
||||
c.Check(response.Body.String(), Equals, "null")
|
||||
c.Check(response.Body.String(), Equals, "[]")
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func NewList() *List {
|
||||
|
||||
// GetTasks gets complete list of tasks
|
||||
func (list *List) GetTasks() []Task {
|
||||
var tasks []Task
|
||||
tasks := []Task{}
|
||||
list.Lock()
|
||||
for _, task := range list.tasks {
|
||||
tasks = append(tasks, *task)
|
||||
|
||||
Reference in New Issue
Block a user