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

can't get integer parameters after upgrade to 1.10.0 version #1006

Closed
mydearxym opened this issue Feb 3, 2021 · 1 comment
Closed

can't get integer parameters after upgrade to 1.10.0 version #1006

mydearxym opened this issue Feb 3, 2021 · 1 comment

Comments

@mydearxym
Copy link

mydearxym commented Feb 3, 2021

hi there ~

i got this error after upgrade plug from 1.9.0 to 1.10.0, it seems in plug@1.10.0(and later versions) request parameter values are always strings (same code base works fine with plug@1.9.0) ?

image

i do need integer parameter for my GraphQL endpoint, currently it just broken the tests

i have checked the #966 and #941, but the problem is still the same and quite confused

env info:

  elixir 1.10.3
  ---
  {:phoenix, "~> 1.4.17"}, 
  {:phoenix_pubsub, "~> 1.1.2"},
  {:phoenix_html, "~> 2.14.3"},
  {:ecto_sql, "~> 3.5.4"},
  {:phoenix_ecto, "~> 4.2.1"},
  {:postgrex, "~> 0.15.8"},
  {:gettext, "~> 0.18.0"},
  {:plug_cowboy, "~> 2.4.1"},
  {:plug, "~> 1.10.0"},  # 1.9.0 works fine
@josevalim
Copy link
Member

Yes, the browser will always send strings for www-form, so the tests were changed to mirror that. You need to explicitly cast or convert it to an integer before, or change your tests to pass a body+content-type that will parse it as an integer, such as JSON.

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

2 participants