From 00e0c0170385cc2bd8a9ac599f5462d75292efde Mon Sep 17 00:00:00 2001 From: Gibheer Date: Tue, 13 Aug 2013 13:20:36 +0200 Subject: fix paramter extraction with charset This fixes a bug where a charset in the content type blocked the extraction of the payload. A browser may send a string like multipart/form-data; charset=UTF-8 which include? could not find the defined types. Now it gets split and then checked against the defined types. --- spec/unit/zero/request/parameter/payload_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec') diff --git a/spec/unit/zero/request/parameter/payload_spec.rb b/spec/unit/zero/request/parameter/payload_spec.rb index 9cf1198..6f54361 100644 --- a/spec/unit/zero/request/parameter/payload_spec.rb +++ b/spec/unit/zero/request/parameter/payload_spec.rb @@ -50,6 +50,16 @@ describe Zero::Request::Parameter, '#payload' do its(:payload) { should == {'bar[]' => ['foo', 'bar']} } end + context 'with encoding in the content type' do + let(:env) do + EnvGenerator.post('/foo', { + :input => 'foo=bar', + 'CONTENT_TYPE' => 'multipart/form-data; charset=UTF-8' + }) + end + its(:payload) { should == {'foo' => 'bar'} } + end + # TODO behaves like this, but is this really good like this? context 'with a post body and content type application/json' do let(:env) do -- cgit v1.2.3-70-g09d2