1
0
Fork 0

Compress JSON, CSS and Javascript responses

This commit is contained in:
Frédéric Guillot 2018-07-19 19:27:05 -07:00
parent a291d8a38b
commit 9f6533ece9
14 changed files with 41 additions and 35 deletions

View file

@ -83,7 +83,7 @@ func (c *Controller) GetCategories(w http.ResponseWriter, r *http.Request) {
return
}
json.OK(w, categories)
json.OK(w, r, categories)
}
// RemoveCategory is the API handler to remove a category.

View file

@ -48,7 +48,7 @@ func (c *Controller) GetFeedEntry(w http.ResponseWriter, r *http.Request) {
return
}
json.OK(w, entry)
json.OK(w, r, entry)
}
// GetEntry is the API handler to get a single entry.
@ -73,7 +73,7 @@ func (c *Controller) GetEntry(w http.ResponseWriter, r *http.Request) {
return
}
json.OK(w, entry)
json.OK(w, r, entry)
}
// GetFeedEntries is the API handler to get all feed entries.
@ -132,7 +132,7 @@ func (c *Controller) GetFeedEntries(w http.ResponseWriter, r *http.Request) {
return
}
json.OK(w, &entriesResponse{Total: count, Entries: entries})
json.OK(w, r, &entriesResponse{Total: count, Entries: entries})
}
// GetEntries is the API handler to fetch entries.
@ -184,7 +184,7 @@ func (c *Controller) GetEntries(w http.ResponseWriter, r *http.Request) {
return
}
json.OK(w, &entriesResponse{Total: count, Entries: entries})
json.OK(w, r, &entriesResponse{Total: count, Entries: entries})
}
// SetEntryStatus is the API handler to change the status of entries.

View file

@ -146,7 +146,7 @@ func (c *Controller) GetFeeds(w http.ResponseWriter, r *http.Request) {
return
}
json.OK(w, feeds)
json.OK(w, r, feeds)
}
// GetFeed is the API handler to get a feed.
@ -168,7 +168,7 @@ func (c *Controller) GetFeed(w http.ResponseWriter, r *http.Request) {
return
}
json.OK(w, feed)
json.OK(w, r, feed)
}
// RemoveFeed is the API handler to remove a feed.

View file

@ -37,7 +37,7 @@ func (c *Controller) FeedIcon(w http.ResponseWriter, r *http.Request) {
return
}
json.OK(w, &feedIcon{
json.OK(w, r, &feedIcon{
ID: icon.ID,
MimeType: icon.MimeType,
Data: icon.DataURL(),

View file

@ -36,5 +36,5 @@ func (c *Controller) GetSubscriptions(w http.ResponseWriter, r *http.Request) {
return
}
json.OK(w, subscriptions)
json.OK(w, r, subscriptions)
}

View file

@ -22,7 +22,7 @@ func (c *Controller) CurrentUser(w http.ResponseWriter, r *http.Request) {
return
}
json.OK(w, user)
json.OK(w, r, user)
}
// CreateUser is the API handler to create a new user.
@ -119,7 +119,7 @@ func (c *Controller) Users(w http.ResponseWriter, r *http.Request) {
}
users.UseTimezone(ctx.UserTimezone())
json.OK(w, users)
json.OK(w, r, users)
}
// UserByID is the API handler to fetch the given user by the ID.
@ -148,7 +148,7 @@ func (c *Controller) UserByID(w http.ResponseWriter, r *http.Request) {
}
user.UseTimezone(ctx.UserTimezone())
json.OK(w, user)
json.OK(w, r, user)
}
// UserByUsername is the API handler to fetch the given user by the username.
@ -171,7 +171,7 @@ func (c *Controller) UserByUsername(w http.ResponseWriter, r *http.Request) {
return
}
json.OK(w, user)
json.OK(w, r, user)
}
// RemoveUser is the API handler to remove an existing user.