mirror of
https://github.com/ilyakooo0/servant-quickcheck.git
synced 2024-08-16 22:00:32 +03:00
QueryFlags don't use =
* Also, fix import for old `Servant` versions - _every_ version now needs `Data.Bytestring` (i.e. Servant version < 0.8, as per old lts in `stack.yaml`)
This commit is contained in:
parent
77fa490b93
commit
2109326ad7
@ -15,9 +15,8 @@ import Servant
|
||||
import Servant.API.ContentTypes (AllMimeRender (..))
|
||||
import Servant.Client (BaseUrl (..), Scheme (..))
|
||||
import Test.QuickCheck (Arbitrary (..), Gen, elements, oneof)
|
||||
#if MIN_VERSION_servant(0,8,0)
|
||||
|
||||
import qualified Data.ByteString as BS
|
||||
#endif
|
||||
|
||||
|
||||
class HasGenRequest a where
|
||||
@ -120,9 +119,8 @@ instance (KnownSymbol x, HasGenRequest b)
|
||||
genRequest _ = do
|
||||
old' <- old
|
||||
return $ \burl -> let r = old' burl
|
||||
newExpr = param <> "="
|
||||
qs = queryString r in r {
|
||||
queryString = if BS.null qs then newExpr else newExpr <> "&" <> qs }
|
||||
queryString = if BS.null qs then param else param <> "&" <> qs }
|
||||
where
|
||||
old = genRequest (Proxy :: Proxy b)
|
||||
param = cs $ symbolVal (Proxy :: Proxy x)
|
||||
|
@ -133,7 +133,7 @@ queryFlagsSpec = describe "QueryFlags" $ do
|
||||
gen = genRequest flagsAPI
|
||||
req = (unGen gen rng 0) burl
|
||||
qs = C.unpack $ queryString req
|
||||
qs `shouldBe` "one=&two="
|
||||
qs `shouldBe` "one&two"
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- APIs
|
||||
|
Loading…
Reference in New Issue
Block a user