changed to see Response Status

This commit is contained in:
Hiromi Ishii 2011-05-19 20:58:09 +09:00
parent f3d305506c
commit 6b63940345

View File

@ -114,8 +114,12 @@ getAccessToken, getTokenCredential
getAccessToken oa cr = do getAccessToken oa cr = do
let req = (fromJust $ parseUrl $ oauthAccessTokenUri oa) { method = "POST" } let req = (fromJust $ parseUrl $ oauthAccessTokenUri oa) { method = "POST" }
rsp <- signOAuth oa cr req >>= withManager . httpLbs rsp <- signOAuth oa cr req >>= withManager . httpLbs
let dic = parseSimpleQuery . toStrict . responseBody $ rsp if statusCode rsp == 200
return $ Credential dic then do
let dic = parseSimpleQuery . toStrict . responseBody $ rsp
return $ Credential dic
else throwIO . OAuthException $ "Gaining OAuth Temporary Credential Failed: " ++ BSL.unpack (responseBody rsp)
getTokenCredential = getAccessToken getTokenCredential = getAccessToken