fix request json - apparently it needs to be an array, not an object

This commit is contained in:
Ben Sima 2020-10-20 16:56:15 -04:00
parent d39506bd3c
commit f952351191
2 changed files with 15 additions and 13 deletions

View File

@ -86,14 +86,15 @@ poke sess ship shipName app mark json =
sess
(channelUrl ship)
$ Aeson.toJSON $
Aeson.object
[ "id" .= nextEventId ship,
"action" .= Text.pack "poke",
"ship" .= shipName,
"app" .= app,
"mark" .= mark,
"json" .= json
]
[ Aeson.object
[ "id" .= nextEventId ship,
"action" .= Text.pack "poke",
"ship" .= shipName,
"app" .= app,
"mark" .= mark,
"json" .= json
]
]
-- | Acknowledge receipt of a message. (This clears it from the ship's queue.)
ack :: Session.Session -> Ship -> Int -> IO (Wreq.Response L.ByteString)
@ -102,10 +103,11 @@ ack sess ship eventId =
sess
(channelUrl ship)
$ Aeson.toJSON $
Aeson.object
[ "action" .= Text.pack "ack",
"event-id" .= eventId
]
[ Aeson.object
[ "action" .= Text.pack "ack",
"event-id" .= eventId
]
]
-- |
subscribe :: Ship -> Path -> OutputStream ByteString -> IO ()

View File

@ -46,7 +46,7 @@ main = do
"number" .= (1 :: Int), -- FIXME: should this be lastEventId?
"author" .= Text.pack "~zod",
"when" .= (1602118786225 :: Int),
"letter" .= Aeson.object ["text" .= Text.pack "hello world!"]
"letter" .= Aeson.object ["text" .= Text.pack "hello world from haskell!"]
]
]
]