diff options
author | Julio Capote <jcapote@gmail.com> | 2022-12-30 03:32:16 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2022-12-30 03:32:16 +0000 |
commit | 74ffcfe6b2c80b7cf459798dc42bd278075ccb50 (patch) | |
tree | 231880fb4de3cf900d03c33531d2afc9603432d3 /http | |
parent | a4288b06bf13210721c8f2fae64bc12c118f9041 (diff) | |
download | communique-74ffcfe6b2c80b7cf459798dc42bd278075ccb50.tar.gz |
experiment with write JSON to database and munge it for collections
Diffstat (limited to 'http')
-rw-r--r-- | http/server.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/http/server.go b/http/server.go index b02e5c9..78d916c 100644 --- a/http/server.go +++ b/http/server.go @@ -62,15 +62,18 @@ func (s *Server) Start(zapWriter io.Writer) { // Outbox router.GET("/actors/:actor/outbox", func(c *gin.Context) { actorParam := c.Param("actor") - var resource map[string]interface{} + var found bool if c.Query("page") == "true" { - resource, _ = s.registry.OutboxPage(actorParam) + resource, _ := s.registry.OutboxCollection(actorParam) + c.String(http.StatusOK, resource) + found = true } else { - resource, _ = s.registry.Outbox(actorParam) + resource, _ := s.registry.Outbox(actorParam) + c.JSON(http.StatusOK, resource) + found = true } - if resource != nil { + if found { c.Writer.Header().Set("Content-Type", "application/activity+json") - c.JSON(http.StatusOK, resource) } else { c.JSON(http.StatusNotFound, nil) } |