Drop wai-extra dependency
This commit is contained in:
parent
5fa2e390c1
commit
35b3e31a45
@ -20,7 +20,7 @@ import qualified Data.ByteString.Char8 as BS
|
|||||||
import qualified Data.ByteString.Lazy.Char8 as BSL
|
import qualified Data.ByteString.Lazy.Char8 as BSL
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Network.Wai.Parse
|
import Network.HTTP.Types (parseSimpleQuery)
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Data.List (sortBy)
|
import Data.List (sortBy)
|
||||||
@ -93,7 +93,7 @@ getTemporaryCredential oa = do
|
|||||||
let req = fromJust $ parseUrl $ oauthRequestUri oa
|
let req = fromJust $ parseUrl $ oauthRequestUri oa
|
||||||
req' <- signOAuth oa emptyCredential (req { method = "POST" })
|
req' <- signOAuth oa emptyCredential (req { method = "POST" })
|
||||||
rsp <- withManager $ httpLbs req'
|
rsp <- withManager $ httpLbs req'
|
||||||
let dic = parseQueryString . toStrict . responseBody $ rsp
|
let dic = parseSimpleQuery . toStrict . responseBody $ rsp
|
||||||
return $ Credential dic
|
return $ Credential dic
|
||||||
|
|
||||||
-- | URL to obtain OAuth verifier.
|
-- | URL to obtain OAuth verifier.
|
||||||
@ -110,7 +110,7 @@ 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 = parseQueryString . toStrict . responseBody $ rsp
|
let dic = parseSimpleQuery . toStrict . responseBody $ rsp
|
||||||
return $ Credential dic
|
return $ Credential dic
|
||||||
|
|
||||||
getTokenCredential = getAccessToken
|
getTokenCredential = getAccessToken
|
||||||
@ -214,7 +214,7 @@ getBaseString tok req = do
|
|||||||
bsURI = BS.concat [scheme, "://", host req, bsPort, path req]
|
bsURI = BS.concat [scheme, "://", host req, bsPort, path req]
|
||||||
bsQuery = map (second $ fromMaybe "") $ queryString req
|
bsQuery = map (second $ fromMaybe "") $ queryString req
|
||||||
bsBodyQ <- if isBodyFormEncoded $ requestHeaders req
|
bsBodyQ <- if isBodyFormEncoded $ requestHeaders req
|
||||||
then liftM parseQueryString $ toLBS (requestBody req)
|
then liftM parseSimpleQuery $ toLBS (requestBody req)
|
||||||
else return []
|
else return []
|
||||||
let bsAuthParams = filter ((`notElem`["oauth_signature","realm", "oauth_token_secret"]).fst) $ unCredential tok
|
let bsAuthParams = filter ((`notElem`["oauth_signature","realm", "oauth_token_secret"]).fst) $ unCredential tok
|
||||||
allParams = bsQuery++bsBodyQ++bsAuthParams
|
allParams = bsQuery++bsBodyQ++bsAuthParams
|
||||||
|
|||||||
@ -30,7 +30,6 @@ library
|
|||||||
base64-bytestring >= 0.1 && < 0.2,
|
base64-bytestring >= 0.1 && < 0.2,
|
||||||
SHA >= 1.4 && < 1.5,
|
SHA >= 1.4 && < 1.5,
|
||||||
random >= 1.0 && < 1.1,
|
random >= 1.0 && < 1.1,
|
||||||
wai-extra >= 0.3 && < 0.4,
|
|
||||||
text >= 0.5 && < 1.0,
|
text >= 0.5 && < 1.0,
|
||||||
http-types >= 0.6 && < 0.7,
|
http-types >= 0.6 && < 0.7,
|
||||||
enumerator >= 0.4.7 && < 0.5,
|
enumerator >= 0.4.7 && < 0.5,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user