[Groonga-commit] groonga/groonga-command [master] http: ignore key only argument

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Apr 11 17:35:53 JST 2013


Kouhei Sutou	2013-04-11 17:35:53 +0900 (Thu, 11 Apr 2013)

  New Revision: 77284489823509d8b957ce9dfe679c399c1d9db5
  https://github.com/groonga/groonga-command/commit/77284489823509d8b957ce9dfe679c399c1d9db5

  Message:
    http: ignore key only argument

  Modified files:
    lib/groonga/command/parser.rb
    test/test-parser.rb

  Modified: lib/groonga/command/parser.rb (+1 -0)
===================================================================
--- lib/groonga/command/parser.rb    2013-04-11 17:25:44 +0900 (a1240f9)
+++ lib/groonga/command/parser.rb    2013-04-11 17:35:53 +0900 (f6b4f7d)
@@ -397,6 +397,7 @@ module Groonga
         if arguments_string
           arguments_string.split(/&/).each do |argument_string|
             key, value = argument_string.split(/\=/, 2)
+            next if value.nil?
             arguments[key] = CGI.unescape(value)
           end
         end

  Modified: test/test-parser.rb (+6 -0)
===================================================================
--- test/test-parser.rb    2013-04-11 17:25:44 +0900 (0191c32)
+++ test/test-parser.rb    2013-04-11 17:35:53 +0900 (5992116)
@@ -43,6 +43,12 @@ class ParserTest < Test::Unit::TestCase
       assert_not_predicate(command, :command_format?)
     end
 
+    def test_no_value
+      path = "/d/select?table=Users&key_only"
+      command = Groonga::Command::Parser.parse(path)
+      assert_equal({:table => "Users"}, command.arguments)
+    end
+
     class ParseTest < self
       include ParseTests
     end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index