@@ -51,6 +51,8 @@ data QueryArg = QueryArg
5151 , _argType :: ArgType
5252 } deriving (Eq, Show)
5353
54+type HeaderArg = String
55+
5456data Url = Url
5557 { _path :: Path
5658 , _queryStr :: [QueryArg]
@@ -63,10 +65,11 @@ type FunctionName = String
6365type Method = String
6466
6567data AjaxReq = AjaxReq
66− { _reqUrl :: Url
67− , _reqMethod :: Method
68− , _reqBody :: Bool
69− , _funcName :: FunctionName
68+ { _reqUrl :: Url
69+ , _reqMethod :: Method
70+ , _reqHeaders :: [HeaderArg]
71+ , _reqBody :: Bool
72+ , _funcName :: FunctionName
7073 } deriving (Eq, Show)
7174
7275makeLenses ''QueryArg
@@ -96,7 +99,7 @@ paramToStr qarg notTheEnd =
9699 where name = qarg ^. argName
97100
98101defReq :: AjaxReq
99−defReq = AjaxReq defUrl "GET" False ""
102+defReq = AjaxReq defUrl "GET" [] False ""
100103
101104class HasJQ layout where
102105 type JQ layout :: *
@@ -134,6 +137,16 @@ instance HasJQ (Get a) where
134137 req & funcName %~ ("get" <>)
135138 & reqMethod .~ "GET"
136139
140+instance (KnownSymbol sym, HasJQ sublayout)
141+ => HasJQ (Header sym a :> sublayout) where
142+ type JQ (Header sym a :> sublayout) = JQ sublayout
143+
144+ jqueryFor Proxy req =
145+ jqueryFor subP (req & reqHeaders <>~ [hname])
146+
147+ where hname = symbolVal (Proxy :: Proxy sym)
148+ subP = Proxy :: Proxy sublayout
149+
137150instance HasJQ (Post a) where
138151 type JQ (Post a) = AjaxReq
139152