Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

20 lines (16 sloc) 0.683 kb
class Response
def self.perform(app)
request = app.request
if d = Double.where(:fullpath => request.fullpath, :active => true, :verb => request.request_method).first
request.body.rewind
body = request.body.read #without temp variable ':body = > body' is always nil. mistery
env = request.env.except('rack.input', 'rack.errors', 'rack.logger')
d.requests.create!(:rack_env => env.to_json, :body => body, :params => request.params.to_json)
app.body d.content
elsif r = Redirect.ordered.find { |r| request.fullpath =~ /#{r.pattern}/ }
app.redirect( "#{r.to}#{request.fullpath}" )
else
app.status 404
end
end
end
Jump to Line
Something went wrong with that request. Please try again.