mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-19 04:41:37 +03:00
94034503c7
Can run '+http://www.example.com' from the dojo.
24 lines
654 B
Haskell
24 lines
654 B
Haskell
-- zuse: +http -----------------------------------------------------------------
|
|
|
|
module Vere.Http where
|
|
|
|
import ClassyPrelude
|
|
import Noun
|
|
import Arvo
|
|
|
|
import qualified Data.CaseInsensitive as CI
|
|
import qualified Network.HTTP.Types as HT
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
convertHeaders :: [HT.Header] -> [Header]
|
|
convertHeaders = fmap f
|
|
where
|
|
f (k, v) = Header (Cord $ decodeUtf8 $ CI.foldedCase k)
|
|
(Cord $ decodeUtf8 v)
|
|
|
|
unconvertHeaders :: [Header] -> [HT.Header]
|
|
unconvertHeaders = fmap f
|
|
where
|
|
f (Header (Cord k) (Cord v)) = (CI.mk (encodeUtf8 k), (encodeUtf8 v))
|