@@ -1,5 +1,6 @@
1{-# LANGUAGE DataKinds #-}
1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE FlexibleInstances #-}
2{-# LANGUAGE FlexibleInstances #-}
3+{-# LANGUAGE LambdaCase #-}
3{-# LANGUAGE OverloadedStrings #-}
4{-# LANGUAGE OverloadedStrings #-}
4{-# LANGUAGE RankNTypes #-}
5{-# LANGUAGE RankNTypes #-}
5{-# OPTIONS_GHC -fno-warn-orphans #-}
6{-# OPTIONS_GHC -fno-warn-orphans #-}
@@ -11,9 +12,10 @@ import Control.Monad.Reader
11import Control.Monad.Trans.Control
12import Control.Monad.Trans.Control
12import Data.Aeson (ToJSON (..), Value (..), object, (.=))
13import Data.Aeson (ToJSON (..), Value (..), object, (.=))
13import qualified Data.Aeson as A
14import qualified Data.Aeson as A
15+import qualified Data.Aeson.KeyMap as Aeson.KeyMap
14import qualified Data.ByteString as B
16import qualified Data.ByteString as B
15import qualified Data.ByteString.Lazy as BL
17import qualified Data.ByteString.Lazy as BL
16−import qualified Data.HashMap.Strict as HM
18+import Data.Functor.Identity (runIdentity)
17import Data.Proxy
19import Data.Proxy
18import Data.Text (Text)
20import Data.Text (Text)
19import qualified Data.Text as T
21import qualified Data.Text as T
@@ -408,13 +410,13 @@ httpbin = https "httpbin.org"
408-- | Remove “origin” field from JSON value. Origin may change, we don't want
410-- | Remove “origin” field from JSON value. Origin may change, we don't want
409-- to depend on that.
411-- to depend on that.
410stripOrigin :: Value -> Value
412stripOrigin :: Value -> Value
411−stripOrigin (Object m) = Object (HM.delete "origin" m)
413+stripOrigin (Object m) = Object (Aeson.KeyMap.delete "origin" m)
412stripOrigin value = value
414stripOrigin value = value
414-- | Remove funny headers that might break the tests.
416-- | Remove funny headers that might break the tests.
415stripFunnyHeaders :: Value -> Value
417stripFunnyHeaders :: Value -> Value
416stripFunnyHeaders (Object m) =
418stripFunnyHeaders (Object m) =
417− let f (Object p) = Object $ HM.filterWithKey (\k _ -> k `elem` hs) p
419+ let f (Object p) = Object $ Aeson.KeyMap.filterWithKey (\k _ -> k `elem` hs) p
418 f value = value
420 f value = value
420 [ "Content-Type",
422 [ "Content-Type",
@@ -424,7 +426,7 @@ stripFunnyHeaders (Object m) =
427− in Object (HM.adjust f "headers" m)
429+ in Object (runIdentity (Aeson.KeyMap.alterF (pure . fmap f) "headers" m))
428stripFunnyHeaders value = value
430stripFunnyHeaders value = value
430-- | This is a complete test case that makes use of <https://httpbin.org> to
432-- | This is a complete test case that makes use of <https://httpbin.org> to
@@ -457,7 +459,7 @@ selector404 _ = False
458-- | The empty JSON 'Object'.
460-- | The empty JSON 'Object'.
459emptyObject :: Value
461emptyObject :: Value
460−emptyObject = Object HM.empty
462+emptyObject = Object Aeson.KeyMap.empty
462-- | Get a rendered JSON value as 'Text'.
464-- | Get a rendered JSON value as 'Text'.
463reflectJSON :: ToJSON a => a -> Text
465reflectJSON :: ToJSON a => a -> Text