File tree 3 files changed +11
-4
lines changed
servant-docs/test/Servant
3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,6 @@ import Control.Monad
22
22
import Control.Monad.Trans.Writer
23
23
(Writer , runWriter , tell )
24
24
import Data.Aeson
25
- import Data.Data
26
- (Data )
27
25
import Data.List
28
26
(isInfixOf )
29
27
import Data.Proxy
@@ -161,7 +159,7 @@ spec = describe "Servant.Docs" $ do
161
159
162
160
data Datatype1 = Datatype1 { dt1field1 :: String
163
161
, dt1field2 :: Int
164
- } deriving (Eq , Show , Data , Generic )
162
+ } deriving (Eq , Show , Generic )
165
163
166
164
instance ToJSON Datatype1
167
165
instance ToForm Datatype1
Original file line number Diff line number Diff line change @@ -607,7 +607,7 @@ instance
607
607
mev :: Maybe (Either T. Text a )
608
608
mev = case B. length rawQS of
609
609
0 -> Nothing
610
- _ -> Just $ urlDecodeAsForm ( BL. drop 1 . BL. fromStrict $ rawQS)
610
+ _ -> Just $ urlDecodeAsForm $ BL. drop 1 $ BL. fromStrict rawQS
611
611
612
612
errReq = delayedFailFatal err400
613
613
{ errBody = " Query parameter form is required"
Original file line number Diff line number Diff line change @@ -514,6 +514,15 @@ queryParamFormSpec = do
514
514
}
515
515
liftIO $ do
516
516
decode' (simpleBody response1) `shouldBe` (Just $ Animal { species = " bimac" , numberOfLegs = 7 })
517
+ it " Just a question mark will match but return a Left" $
518
+ (flip runSession) (serve queryParamFormApi qpFormServer) $ do
519
+ let paramsQ = " ?"
520
+ response1 <- Network.Wai.Test. request defaultRequest{
521
+ rawQueryString = paramsQ,
522
+ queryString = parseQuery paramsQ
523
+ }
524
+ liftIO $ do
525
+ decode' (simpleBody response1) `shouldBe` (Just $ Animal { species = " broken" , numberOfLegs = 0 })
517
526
it " allows no query params at all" $
518
527
(flip runSession) (serve queryParamFormApi qpFormServer) $ do
519
528
response1 <- Network.Wai.Test. request defaultRequest
You can’t perform that action at this time.
0 commit comments