-
Notifications
You must be signed in to change notification settings - Fork 19
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
Support duplicate form names in multipart forms #32
base: master
Are you sure you want to change the base?
Conversation
571e0c5
to
2631b36
Compare
@ixti I added a line to your spec for multipart 'pairs'. I think that a boundary is required between each 'body part' as per RFC 1341 7.2. You should double check me though, I don't wade in these water's every day. I altered the Additionally, I added a spec helper config that was really helpful for figuring out what was failing. I suspect the config is not everyone's cup of tea since the default Let me know what you think. Would love to talk shop. |
14c6985
to
efb5549
Compare
Yeah, thank you. It was unintentional typo from my end.
After some consideration, I think I'm actually more in favour of more flexible handling. What I mean is, we allow this: { :foo => [1, 2, 3] } That is supported now, and will create 3 parts with same name, but different values (1, 2, and 3), so we should support at least: [:foo, [1, 2, 3]] Which we do with this RP currently. But why not allow any Enumerable? For example: some_array.lazy.select(&some_filter) Right now we will convert the above to
I think I'm more against this one than agree with. :D It can be easily done local-only adding: # file: .rspec-local
--require ~/.my-rspec-config.rb # file: ~/.my-rspec-config.rb
RSpec.configure do |config|
# overwrite project's config as you feel it :D
end |
@mathisto I have rewrote tests a bit (and added similar test to urlencoded one too). |
After giving it a second thought, Rack and Addressable support only |
This reverts commit 52c66d9.
@mathisto can you, please, make sure that both urlencoded and multipart encoders behave consistently? |
Co-authored-by: Alexey Zapparov <[email protected]>
The more I think the more I believe that there's no point in limiting to Array/Hash. I mean we really only care that it's an Enumerable that yields at one or two arguments, and we don't care about the rest: [[1], [2, 3], [4, 5, 6]].map { |k, v| "#{k}=#{v}" }.join("&")
# => "1=&2=3&4=5"
{ 1 => nil, 2 => 3 }.map { |k, v| "#{k}=#{v}" }.join("&")
# => "1=&2=3"
Enumerator
.new { |y| y << [1] << [2, 3] << [4, 5, 6] }
.map { |k, v| "#{k}=#{v}" }
.join("&")
# => "1=&2=3&4=5" So, I'm not really sure why we treat |
In fact I think I would accept any input that responds to |
Ok I like it. Especially dropping the coerce. I'll knock this out tonight after the kids are in bed. |
Resolves: httprb/http#663