File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -118,8 +118,12 @@ param key = Match \route ->
118118 case M .lookup key map of
119119 Nothing ->
120120 invalid $ free $ KeyNotFound key
121- Just el ->
122- pure $ Tuple (Cons (Query <<< M .delete key $ map) rs) el
121+ Just el -> do
122+ let remainingParams = M .delete key map
123+ pure $
124+ if M .isEmpty remainingParams
125+ then Tuple rs el
126+ else Tuple (Cons (Query remainingParams) rs) el
123127 _ ->
124128 invalid $ free ExpectedQuery
125129
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ instance showMyRoutes :: Show MyRoutes where show = genericShow
3535routing :: Match MyRoutes
3636routing = oneOf
3737 [ Foo <$> (lit " foo" *> num) <*> params
38- , Bar <$> (lit " bar" *> bool) <*> (param " baz" )
38+ , Bar <$> (lit " bar" *> bool) <*> (param " baz" ) <* end
3939 , Baz <$> (lit " list" *> list num)
4040 , Quux <$> (lit " " *> lit " quux" *> int)
4141 , Corge <$> (lit " corge" *> str)
@@ -57,6 +57,10 @@ main = do
5757 { actual: match routing " bar/true?baz=test"
5858 , expected: Right (Bar true " test" )
5959 }
60+ assertEqual
61+ { actual: lmap (const unit) (match routing " bar/true?baz=test&oof=true" )
62+ , expected: Left unit
63+ }
6064 assertEqual
6165 { actual: match routing " bar/false?baz=%D0%B2%D1%80%D0%B5%D0%BC%D0%B5%D0%BD%D0%BD%D1%8B%D0%B9%20%D1%84%D0%B0%D0%B9%D0%BB"
6266 , expected: Right (Bar false " временный файл" )
You can’t perform that action at this time.
0 commit comments