File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
matrix-client/src/Network/Matrix Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -631,10 +631,10 @@ inviteToRoom :: ClientSession -> RoomID -> UserID -> Maybe T.Text -> MatrixIO ()
631631inviteToRoom session (RoomID rid) (UserID uid) reason = do
632632 request <- mkRequest session True $ " /_matrix/client/v3/rooms/" <> rid <> " /invite"
633633 let body = object $ [(" user_id" , toJSON uid)] <> catMaybes [fmap ((" reason" ,) . toJSON) reason]
634- doRequest session $
634+ fmap (ensureEmptyObject " invite " ) <$> ( doRequest session $
635635 request { HTTP. method = " POST"
636636 , HTTP. requestBody = HTTP. RequestBodyLBS $ encode body
637- }
637+ })
638638
639639-- | Note that this API takes either a room ID or alias, unlike 'joinRoomById'
640640-- https://spec.matrix.org/v1.1/client-server-api/#post_matrixclientv3joinroomidoralias
@@ -1352,3 +1352,8 @@ tshow = T.pack . show
13521352
13531353escapeUriComponent :: T. Text -> T. Text
13541354escapeUriComponent = T. pack . URI. escapeURIString URI. isUnreserved . T. unpack
1355+
1356+ ensureEmptyObject :: String -> Value -> ()
1357+ ensureEmptyObject apiName value = case value of
1358+ Object xs | xs == mempty -> ()
1359+ _ -> error $ " Unknown " <> apiName <> " response: " <> show value
You can’t perform that action at this time.
0 commit comments