Skip to content

Commit

Permalink
Fixes #69.
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrap committed Dec 27, 2017
1 parent c143226 commit 0f34d14
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Network/Wreq.hs
Expand Up @@ -431,7 +431,8 @@ asJSON :: (MonadThrow m, FromJSON a) =>
asJSON resp = do
let contentType = fst . S.break (==59) . fromMaybe "unknown" .
lookup "Content-Type" . HTTP.responseHeaders $ resp
unless ("application/json" `S.isPrefixOf` contentType) $
unless ("application/json" `S.isPrefixOf` contentType
|| ("application/" `S.isPrefixOf` contentType && "+json" `S.isSuffixOf` contentType)) $
throwM . JSONError $ "content type of response is " ++ show contentType
case Aeson.eitherDecode' (HTTP.responseBody resp) of
Left err -> throwM (JSONError err)
Expand Down

0 comments on commit 0f34d14

Please sign in to comment.