@@ -42,7 +42,7 @@ import Control.Applicative
4242import Data.Monoid ((<>))
4343import qualified Data.Set as Set
4444import qualified Data.Text.Encoding as E
45−import Data.CaseInsensitive (mk)
45+import qualified Data.CaseInsensitive as CI
4646import Data.Functor.Identity
4747import Data.Proxy (Proxy (..))
4848import qualified Data.Map as Map
@@ -226,22 +226,26 @@ instance {-# OVERLAPPING #-}
226226
227227toHeaders :: BuildHeadersTo ls => ReqResult tag a -> ReqResult tag (Headers ls a)
228228toHeaders r =
229− let toBS = E.encodeUtf8
230− hdrs = maybe []
231− (\xhr -> fmap (\(h,v) -> (mk (toBS h), toBS v))
229+ let hdrs = maybe []
230+ (\xhr -> fmap (\(h,v) -> (CI.map E.encodeUtf8 h, E.encodeUtf8 v))
232231 (Map.toList $ _xhrResponse_headers xhr))
233232 (response r)
234233 in ffor r $ \a -> Headers {getResponse = a ,getHeadersHList = buildHeadersTo hdrs}
235234
235+
236236class BuildHeaderKeysTo hs where
237− buildHeaderKeysTo :: Proxy hs -> [T.Text]
237+ buildHeaderKeysTo :: Proxy hs -> [CI.CI T.Text]
238238
239239instance {-# OVERLAPPABLE #-} BuildHeaderKeysTo '[]
240240 where buildHeaderKeysTo _ = []
241241
242242instance {-# OVERLAPPABLE #-} (BuildHeaderKeysTo xs, KnownSymbol h)
243243 => BuildHeaderKeysTo ((Header h v) ': xs) where
244− buildHeaderKeysTo _ = T.pack (symbolVal (Proxy :: Proxy h)) : buildHeaderKeysTo (Proxy :: Proxy xs)
244+ buildHeaderKeysTo _ =
245+ let
246+ thisKey = CI.mk $ T.pack (symbolVal (Proxy :: Proxy h))
247+ in thisKey : buildHeaderKeysTo (Proxy :: Proxy xs)
248+
245249
246250-- HEADERS Verb (Content) --
247251-- Headers combinator not treated in fully general case,