2020-01-23 07:16:09 +03:00
|
|
|
{-|
|
|
|
|
HTTP Driver
|
|
|
|
-}
|
2019-05-16 03:00:10 +03:00
|
|
|
|
2020-01-24 08:28:38 +03:00
|
|
|
module Urbit.Vere.Http where
|
2019-05-16 03:00:10 +03:00
|
|
|
|
|
|
|
import ClassyPrelude
|
2020-01-24 08:28:38 +03:00
|
|
|
import Urbit.Arvo
|
|
|
|
import Urbit.Noun
|
2019-05-16 03:00:10 +03:00
|
|
|
|
2019-08-02 09:56:42 +03:00
|
|
|
import qualified Data.CaseInsensitive as CI
|
|
|
|
import qualified Network.HTTP.Types as HT
|
2019-05-24 02:58:18 +03:00
|
|
|
|
2019-06-28 00:28:58 +03:00
|
|
|
--------------------------------------------------------------------------------
|
2019-05-24 02:58:18 +03:00
|
|
|
|
|
|
|
convertHeaders :: [HT.Header] -> [Header]
|
|
|
|
convertHeaders = fmap f
|
|
|
|
where
|
2019-08-08 01:24:02 +03:00
|
|
|
f (k, v) = Header (Cord $ decodeUtf8 $ CI.foldedCase k)
|
2019-12-13 13:10:53 +03:00
|
|
|
(MkBytes v)
|
2019-08-03 03:09:53 +03:00
|
|
|
|
|
|
|
unconvertHeaders :: [Header] -> [HT.Header]
|
|
|
|
unconvertHeaders = fmap f
|
|
|
|
where
|
2019-12-13 13:10:53 +03:00
|
|
|
f (Header (Cord k) (MkBytes v)) = (CI.mk (encodeUtf8 k), v)
|