summaryrefslogtreecommitdiff
path: root/internal/api/activitypub/users/featured.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/api/activitypub/users/featured.go')
-rw-r--r--internal/api/activitypub/users/featured.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/internal/api/activitypub/users/featured.go b/internal/api/activitypub/users/featured.go
index 7a2b73a6f..f256c1e75 100644
--- a/internal/api/activitypub/users/featured.go
+++ b/internal/api/activitypub/users/featured.go
@@ -18,7 +18,6 @@
package users
import (
- "encoding/json"
"errors"
"net/http"
"strings"
@@ -67,13 +66,13 @@ func (m *Module) FeaturedCollectionGETHandler(c *gin.Context) {
return
}
- format, err := apiutil.NegotiateAccept(c, apiutil.ActivityPubOrHTMLHeaders...)
+ contentType, err := apiutil.NegotiateAccept(c, apiutil.ActivityPubOrHTMLHeaders...)
if err != nil {
apiutil.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGetV1)
return
}
- if format == string(apiutil.TextHTML) {
+ if contentType == string(apiutil.TextHTML) {
// This isn't an ActivityPub request;
// redirect to the user's profile.
c.Redirect(http.StatusSeeOther, "/@"+requestedUsername)
@@ -86,11 +85,5 @@ func (m *Module) FeaturedCollectionGETHandler(c *gin.Context) {
return
}
- b, err := json.Marshal(resp)
- if err != nil {
- apiutil.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGetV1)
- return
- }
-
- c.Data(http.StatusOK, format, b)
+ apiutil.JSONType(c, http.StatusOK, contentType, resp)
}