lib/lookout/rack/utils/subroute.rb in lookout-rack-utils-1.4.0 vs lib/lookout/rack/utils/subroute.rb in lookout-rack-utils-1.5.0
- old
+ new
@@ -1,7 +1,11 @@
module Lookout::Rack::Utils
module Subroute
- def subroute!(relative_path)
+ def subroute!(relative_path, options={})
+ http_verb = request.request_method
+ # modify rack environment using Rack::Request- store passed in key/value
+ # pairs into hash associated with the parameters of the current http verb
+ options.each { |k,v| request.send(http_verb)[k] = v }
subcode, subheaders, body = call(env.merge('PATH_INFO' => relative_path))
return [subcode, body.first]
end
# Returns true if the status given is 20x