kenichi/angelo

Angelo::FormEncodingError when sending param without a value

chewi opened this issue · 5 comments

Not a big deal here, just thought I'd mention it. If you request a URL like /foo?bar then a Angelo::FormEncodingError exception is raised due to the lack of = even though this is a valid URL. I would expect bar to be present in the params hash as an empty string.

oops! should be fixed by 905a66b

@chewi was thinking a bit more on this - with the above commit, a request like /foo?bar would not raise an error anymore, but would give a params hash like:

{"bar"=>nil}

in this case, if params[:bar] would be falsy. i kind of feel like it should be:

{'bar"=>""}

so that if params[:bar] would be truthy. what do you think?

p.s. sinatra does it the {"bar"=>nil} way

I usually use Rails and that returns nil too so I would definitely stick with that, despite what I said above. It's worth noting that ?bar= returns an empty string.

not that i'm opposed to deviating from rack, but i'll leave it as is for now 😺