1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-28 22:04:51 +09:00

In httpGetAP, if we got an unexpected Content-Type, specify it in error message

This commit is contained in:
fr33domlover 2019-01-21 22:24:09 +00:00
parent 2a68bb560b
commit 04e26a911d
2 changed files with 3 additions and 3 deletions

View file

@ -273,7 +273,7 @@ postOutboxR = do
case eres of
Left (APGetErrorHTTP e) -> setMessage $ toHtml $ "Failed to GET the recipient actor: " <> T.pack (displayException e)
Left (APGetErrorJSON e) -> setMessage $ toHtml $ "Failed to parse recipient actor JSON: " <> T.pack (displayException e)
Left (APGetErrorContentType e) -> setMessage $ toHtml $ "Got unexpected Content-Type for actor JSON: " <> T.pack e
Left (APGetErrorContentType e) -> setMessage $ toHtml $ "Got unexpected Content-Type for actor JSON: " <> e
Right response -> do
let actor = getResponseBody response
if actorId actor /= to

View file

@ -254,7 +254,7 @@ provideAP v = do
data APGetError
= APGetErrorHTTP HttpException
| APGetErrorJSON JSONException
| APGetErrorContentType String
| APGetErrorContentType Text
deriving Show
instance Exception APGetError
@ -285,7 +285,7 @@ httpGetAP manager uri =
then case responseBody r of
Left e -> Left $ APGetErrorJSON e
Right v -> Right $ v <$ r
else Left $ APGetErrorContentType "Non-AP Content-Type"
else Left $ APGetErrorContentType $ "Non-AP Content-Type: " <> decodeUtf8 b
_ -> Left $ APGetErrorContentType "Multiple Content-Type"
-- Set method to POST, Set Content-Type, make HTTP signature, set response to throw on non-2xx