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

Empty array is ignored when passed as a param #469

Closed
codemang opened this issue Apr 22, 2016 · 1 comment · Fixed by #477
Closed

Empty array is ignored when passed as a param #469

codemang opened this issue Apr 22, 2016 · 1 comment · Fixed by #477

Comments

@codemang
Copy link

codemang commented Apr 22, 2016

res = HTTParty.get('http://google.com', query: {fake_array: []})
res.request.last_uri.to_s == 'http://www.google.com/'

but...

res = HTTParty.get('http://google.com', query: {fake_array: [1]})
res.request.last_uri.to_s == 'http://www.google.com/?fake_array%5B%5D=1'

Is this intended behavior? Is this a limitation of HTTP?

@jnunemaker
Copy link
Owner

I think it might be this line that rejects empty params which was introduced here. We probably just need a new test that empty array's are fine and trailing ampersands don't get added. Totally open to a PR.

dmitryrck added a commit to dmitryrck/httparty that referenced this issue Jun 7, 2016
dmitryrck added a commit to dmitryrck/httparty that referenced this issue Jun 8, 2016
dmitryrck added a commit to dmitryrck/httparty that referenced this issue Jun 9, 2016
dmitryrck added a commit to dmitryrck/httparty that referenced this issue Jun 11, 2016
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

Successfully merging a pull request may close this issue.

2 participants