summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/nickserver/server.rb4
-rw-r--r--test/unit/nickserver_test.rb9
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/nickserver/server.rb b/lib/nickserver/server.rb
index 2f4d4f0..6234fd6 100644
--- a/lib/nickserver/server.rb
+++ b/lib/nickserver/server.rb
@@ -72,8 +72,10 @@ module Nickserver
elsif @http_post_content
params = CGI.parse(@http_post_content)
end
- if params["address"] && params["address"].any?
+ if params && params["address"] && params["address"].any?
return params["address"].first
+ else
+ return nil
end
end
diff --git a/test/unit/nickserver_test.rb b/test/unit/nickserver_test.rb
index 3a286fa..46e69ca 100644
--- a/test/unit/nickserver_test.rb
+++ b/test/unit/nickserver_test.rb
@@ -74,6 +74,15 @@ class NickserverTest < MiniTest::Unit::TestCase
end
end
+ def test_GET_empty
+ start do
+ get({}) do |http|
+ assert_equal "404 Not Found\n", http.response
+ stop
+ end
+ end
+ end
+
protected
#