diff --git a/CHANGELOG.md b/CHANGELOG.md index 8eb1d5b..4ce7ccb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +Unreleased changes +--- + +* Fix code generation for query flag + 0.9.1 ----- diff --git a/src/Servant/JS/Internal.hs b/src/Servant/JS/Internal.hs index 89155a2..36b31c6 100644 --- a/src/Servant/JS/Internal.hs +++ b/src/Servant/JS/Internal.hs @@ -183,7 +183,7 @@ paramToStr qarg notTheEnd = <> "=' + encodeURIComponent(" <> name <> if notTheEnd then ") + '" else ")" - Flag -> name <> "=" + Flag -> name <> "'" List -> name <> "[]=' + encodeURIComponent(" <> name diff --git a/test/Servant/JSSpec.hs b/test/Servant/JSSpec.hs index 918b0ab..6d083b6 100644 --- a/test/Servant/JSSpec.hs +++ b/test/Servant/JSSpec.hs @@ -26,6 +26,7 @@ import Test.QuickCheck (Arbitrary (..), import Servant.API.Internal.Test.ComprehensiveAPI import Servant.API.ContentTypes +import Servant.API.QueryParam import Servant.JS import Servant.JS.Internal import qualified Servant.JS.Angular as NG @@ -42,6 +43,7 @@ _ = jsForAPI comprehensiveAPIWithoutRaw vanillaJS :: Text -- * specs type TestAPI = "simple" :> ReqBody '[JSON,FormUrlEncoded] Text :> Post '[JSON] Bool + :<|> "params" :> QueryParam "foo" Text :> QueryFlag "flag" :> Get '[JSON] Bool :<|> "has.extension" :> Get '[FormUrlEncoded,JSON] Bool type TopLevelRawAPI = "something" :> Get '[JSON] Int