servant-foreign: Fix rebase changes

This commit is contained in:
aaron levin 2015-11-22 17:35:34 +01:00
parent 4965f1a113
commit fff82de2d8

View file

@ -39,13 +39,13 @@ import Servant.API
import Servant.Foreign.Internal import Servant.Foreign.Internal
import Control.Lens (makeLenses, (%~), (&), (.~), (<>~)) import Control.Lens (makeLenses, (%~), (&), (.~), (<>~))
import qualified Data.Char as C import qualified Data.Char as C
import Data.Monoid ((<>))
import Data.Proxy import Data.Proxy
import Data.Text import Data.Text
import GHC.Exts (Constraint) import GHC.Exts (Constraint)
import GHC.TypeLits import GHC.TypeLits
import Prelude hiding (concat) import Prelude hiding (concat)
import Servant.API import Servant.API
import Servant.API
import Servant.API.Authentication import Servant.API.Authentication
-- | Function name builder that simply concat each part together -- | Function name builder that simply concat each part together
@ -94,12 +94,11 @@ data HeaderArg = HeaderArg
| ReplaceHeaderArg | ReplaceHeaderArg
{ headerArgName :: Text { headerArgName :: Text
, headerPattern :: Text , headerPattern :: Text
} deriving (Eq, Show)
| HeaderArgGen | HeaderArgGen
{ headerArgName :: String { headerArgName :: Text
, headerArgGenBody :: (String -> String) , headerArgGenBody :: (Text -> Text)
} }
deriving (Eq, Show)
data Url = Url data Url = Url
{ _path :: Path { _path :: Path
@ -198,10 +197,10 @@ instance (HasForeign sublayout)
foreignFor Proxy req = foreignFor Proxy req =
foreignFor (Proxy :: Proxy sublayout) (req & reqHeaders <>~ foreignFor (Proxy :: Proxy sublayout) (req & reqHeaders <>~
[HeaderArgGen "Authorization" $ \authdata -> [HeaderArgGen "Authorization" ( \authdata ->
"(function("++authdata++"){" ++ "(function("<>authdata<>"){" <>
"return \"Basic \" + btoa("++authdata++".username+\":\"+"++authdata ++ ".password)" ++ "return \"Basic \" + btoa("<>authdata<>".username+\":\"+"<>authdata <> ".password)" <>
"})("++authdata++")" "})("<>authdata<>")")
]) ])
instance (HasForeign sublayout) instance (HasForeign sublayout)
@ -211,9 +210,9 @@ instance (HasForeign sublayout)
foreignFor Proxy req = foreignFor Proxy req =
foreignFor (Proxy :: Proxy sublayout) (req & reqHeaders <>~ foreignFor (Proxy :: Proxy sublayout) (req & reqHeaders <>~
[HeaderArgGen "Authorization" $ \authdata -> [HeaderArgGen "Authorization" $ \authdata ->
"(function("++authdata++"){" ++ "(function(" <> authdata <> "){" <>
"return \"Bearer \" + "++authdata++";"++ "return \"Bearer \" + "<> authdata <> ";" <>
"})("++authdata++")" "})(" <> authdata<>")"
]) ])
instance Elem JSON list => HasForeign (Post list a) where instance Elem JSON list => HasForeign (Post list a) where