diff options
author | Julio Capote <jcapote@gmail.com> | 2022-12-31 02:20:02 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2022-12-31 02:20:02 +0000 |
commit | c500a2be38afcbb5688537d97c7c3ee30a57dba4 (patch) | |
tree | 79cf1884ca7529299646b567b7705378bdf08fd3 /http | |
parent | 74ffcfe6b2c80b7cf459798dc42bd278075ccb50 (diff) | |
download | communique-c500a2be38afcbb5688537d97c7c3ee30a57dba4.tar.gz |
parse and persist feeds from handlers
Diffstat (limited to '')
-rw-r--r-- | http/server.go | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/http/server.go b/http/server.go index 78d916c..98b4083 100644 --- a/http/server.go +++ b/http/server.go @@ -62,17 +62,14 @@ func (s *Server) Start(zapWriter io.Writer) { // Outbox router.GET("/actors/:actor/outbox", func(c *gin.Context) { actorParam := c.Param("actor") - var found bool + var resource map[string]interface{} if c.Query("page") == "true" { - resource, _ := s.registry.OutboxCollection(actorParam) - c.String(http.StatusOK, resource) - found = true + resource, _ = s.registry.OutboxCollection(actorParam) } else { - resource, _ := s.registry.Outbox(actorParam) - c.JSON(http.StatusOK, resource) - found = true + resource, _ = s.registry.Outbox(actorParam) } - if found { + if resource != nil { + c.JSON(http.StatusOK, resource) c.Writer.Header().Set("Content-Type", "application/activity+json") } else { c.JSON(http.StatusNotFound, nil) |