Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Provide a means to disable params parsing.

  • Loading branch information...
commit e4cfbaec884b0efea4b3f87b0377735b82cfa765 1 parent d6a0081
@myronmarston myronmarston authored
View
3  lib/interpol/sinatra/request_params_parser.rb
@@ -10,6 +10,7 @@ def self.add_to(app, &block)
alias unparsed_params params
helpers SinatraHelpers
set :interpol_config, config
+ enable :parse_params
include SinatraOverriddes
end
end
@@ -71,7 +72,7 @@ module SinatraOverriddes
# matching.
def process_route(*method_args)
super do |*block_args|
- validate_params
+ validate_params if settings.parse_params?
yield *block_args
end
end
View
10 spec/unit/interpol/sinatra/request_params_parser_spec.rb
@@ -143,6 +143,16 @@ def configure_parser(&block)
last_response.status.should eq(404)
end
+ it 'provides a means to disable param parsing' do
+ on_get { 'OK' } # don't use the params
+
+ app.disable :parse_params
+
+ get '/users/foo/projects/ruby'
+ last_response.status.should eq(200)
+ last_response.body.should eq("OK")
+ end
+
context 'when the sinatra app is mounted using Rack::Builder' do
alias sinatra_app app
Please sign in to comment.
Something went wrong with that request. Please try again.