Skip to content

Commit

Permalink
Merge pull request #12 from fierce-katie/fix-query-flag-#11
Browse files Browse the repository at this point in the history
Fix query flag code generation
  • Loading branch information
phadej authored Feb 21, 2017
2 parents a2d33f7 + 9dec269 commit 431d3e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
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

0 comments on commit 431d3e3

Please sign in to comment.