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

QueryFlag is not encoded correctly #11

Closed
fizruk opened this issue Feb 16, 2017 · 2 comments
Closed

QueryFlag is not encoded correctly #11

fizruk opened this issue Feb 16, 2017 · 2 comments

Comments

@fizruk
Copy link
Member

fizruk commented Feb 16, 2017

If you try to use QueryFlag you get invalid JavaScript.

The reason is this line in paramToStr function:

paramToStr :: QueryArg f -> Bool -> Text
paramToStr qarg notTheEnd =
  case qarg ^. queryArgType of
    Normal -> name
           <> "=' + encodeURIComponent("
           <> name
           <> if notTheEnd then ") + '" else ")"
    Flag   -> name <> "=" -------------------- BAD CODE HERE
    List   -> name
           <> "[]=' + encodeURIComponent("
           <> name
           <> if notTheEnd then ") + '" else ")"
  where name = qarg ^. queryArgName . argName . _PathSegment

It should be

    Flag   -> name <> "='" -- close the '

or

    Flag   -> name <> "'" -- close the '
@asilvestre
Copy link

Hi,
I don't think this is fixed, for two regular arguments and a flag in between, as of now it generates javascript like this:
'&arg=' + encodeURIComponent(arg) + '&flag'&arg2=' + encodeURIComponent(arg2)

@fierce-katie
Copy link
Contributor

@asilvestre Opened #19.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants