This commit is contained in:
Henrique Dias 2016-08-11 22:19:21 +01:00
parent eb7920f1c0
commit d9c62e2428
2 changed files with 6 additions and 2 deletions

View File

@ -239,6 +239,10 @@ func (i *Info) serveListing(w http.ResponseWriter, r *http.Request, c *config.Co
page.Minimal = true page.Minimal = true
} }
if strings.Contains(r.Header.Get("Accept"), "application/json") {
return page.PrintAsJSON(w)
}
return page.PrintAsHTML(w, "listing") return page.PrintAsHTML(w, "listing")
} }

View File

@ -27,7 +27,7 @@ type Listing struct {
Order string Order string
// If ≠0 then Items have been limited to that many elements // If ≠0 then Items have been limited to that many elements
ItemsLimitedTo int ItemsLimitedTo int
httpserver.Context httpserver.Context `json:"-"`
} }
// handleSortOrder gets and stores for a Listing the 'sort' and 'order', // handleSortOrder gets and stores for a Listing the 'sort' and 'order',