diff --git a/lib/signature/query_encoder.rb b/lib/signature/query_encoder.rb index 4d62095..ad1802b 100644 --- a/lib/signature/query_encoder.rb +++ b/lib/signature/query_encoder.rb @@ -17,7 +17,7 @@ def encode_param_without_escaping(k, v) if v.is_a?(Array) v.map { |e| k + "[]=" + e }.join("&") else - k + "=" + v + "#{k}=#{v}" end end diff --git a/spec/signature_spec.rb b/spec/signature_spec.rb index f77be90..3d972bf 100644 --- a/spec/signature_spec.rb +++ b/spec/signature_spec.rb @@ -75,6 +75,13 @@ @request.send(:string_to_sign).should == "POST\n/some/path\nkey;=value@" end + it "should cope with requests where the value is nil (antiregression)" do + @request.query_hash = { + "key" => nil + } + @request.send(:string_to_sign).should == "POST\n/some/path\nkey=" + end + it "should use the path to generate signature" do @request.path = '/some/other/path' @request.sign(@token)[:auth_signature].should_not == @signature