diff --git a/lib/rack/sanitize.rb b/lib/rack/sanitize.rb index 115d22f..1b0ca61 100644 --- a/lib/rack/sanitize.rb +++ b/lib/rack/sanitize.rb @@ -5,7 +5,7 @@ class Sanitize def initialize(app) @app = app end - + def call(env) request = Rack::Request.new(env) request.GET.each {|k,v| request.GET[k] = ::Sanitize.clean(v)} diff --git a/spec/rack/sanitize.rb b/spec/rack/sanitize.rb index c29f489..eafa96c 100644 --- a/spec/rack/sanitize.rb +++ b/spec/rack/sanitize.rb @@ -5,21 +5,21 @@ get '/get', {"a" => "ok", "okie" => %Q{}} last_response.body.should == "GETs: a=ok&okie=dokie" end - + it "should sanitize POSTs" do post '/post', {"a" => "ok", "okie" => %Q{}} last_response.body.should == "POSTs: a=ok&okie=dokie" end - + it "should sanitize if the path matches" do - + end - + it "should not sanitize if the path does not match" do - + end - + it "should default to sanitizing both GETs and POSTs" do - + end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4bc3302..726fe65 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -12,11 +12,11 @@ def render_key_value(hash) hash.map {|k,v| "#{k}=#{v}"}.sort.join('&') end end - + get '/get' do "GETs: #{render_key_value(request.GET)}" end - + post '/post' do "POSTs: #{render_key_value(request.POST)}" end @@ -24,7 +24,7 @@ def render_key_value(hash) Spec::Runner.configure do |config| config.include Rack::Test::Methods - + def app @app ||= Rack::Builder.app do use Rack::Sanitize