@@ -142,7 +142,9 @@ performRequest reqMethod req isWantedStatus reqHost = do
142performRequestJSON :: FromJSON result =>
142performRequestJSON :: FromJSON result =>
143 Method -> Req -> Int -> BaseUrl -> EitherT String IO result
143 Method -> Req -> Int -> BaseUrl -> EitherT String IO result
144performRequestJSON reqMethod req wantedStatus reqHost = do
144performRequestJSON reqMethod req wantedStatus reqHost = do
145− (_status, respBody, _) <- performRequest reqMethod req (== wantedStatus) reqHost
145+ (_status, respBody, contentType) <- performRequest reqMethod req (== wantedStatus) reqHost
146+ unless (matches contentType ("application"//"json")) $
147+ left $ "requested Content-Type application/json, but got " <> show contentType
147 (\ message -> left (displayHttpRequest reqMethod ++ " returned invalid json: " ++ message))
149 (\ message -> left (displayHttpRequest reqMethod ++ " returned invalid json: " ++ message))