From 2dba741beb0b1d5239f6e949629457d718cb28a0 Mon Sep 17 00:00:00 2001 From: Catherine Galkina Date: Mon, 20 Feb 2017 12:38:27 +0300 Subject: [PATCH 1/3] Add query param and flag to TestAPI --- test/Servant/JSSpec.hs | 2 ++ 1 file changed, 2 insertions(+) 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 From 4f86a7e42fc0dd36034d1164fc9c25ddaf4c77f5 Mon Sep 17 00:00:00 2001 From: Catherine Galkina Date: Mon, 20 Feb 2017 12:43:27 +0300 Subject: [PATCH 2/3] Fix code generation for query flag --- src/Servant/JS/Internal.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 9dec269bd908502c1caebbc55a23a123ae5fe044 Mon Sep 17 00:00:00 2001 From: Catherine Galkina Date: Mon, 20 Feb 2017 12:50:56 +0300 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) 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 -----