Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix query flag code generation #12

Merged
merged 3 commits into from
Feb 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Unreleased changes
---

* Fix code generation for query flag

0.9.1
-----

Expand Down
2 changes: 1 addition & 1 deletion src/Servant/JS/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ paramToStr qarg notTheEnd =
<> "=' + encodeURIComponent("
<> name
<> if notTheEnd then ") + '" else ")"
Flag -> name <> "="
Flag -> name <> "'"
List -> name
<> "[]=' + encodeURIComponent("
<> name
Expand Down
2 changes: 2 additions & 0 deletions test/Servant/JSSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down