-- stuff to feed back to happstack-server

-- | Takes a list of (key,val) pairs and converts it into Headers.  The
-- keys will be converted to lowercase.
mkHeadersBs :: [(ByteString,ByteString)] -> H.Headers
mkHeadersBs hdrs
    = Map.fromListWith join [ (B8.map toLower key, H.HeaderPair key [value]) | (key,value) <- hdrs ]
    where join (H.HeaderPair key vs1) (H.HeaderPair _ vs2) = H.HeaderPair key (vs1++vs2)
mkHeadersBs :: [(ByteString,ByteString)] -> H.Headers
mkHeadersBs hdrs
    = Map.fromListWith join [ (B8.map toLower key, H.HeaderPair key [value]) | (key,value) <- hdrs ]
    where join (H.HeaderPair key vs1) (H.HeaderPair _ vs2) = H.HeaderPair key (vs1++vs2)
mkHeadersBs hdrs
    = Map.fromListWith join [ (B8.map toLower key, H.HeaderPair key [value]) | (key,value) <- hdrs ]
    where join (H.HeaderPair key vs1) (H.HeaderPair _ vs2) = H.HeaderPair key (vs1++vs2)