Sha256: 1f3f672c808de8c02d0e40698e5367140efca8e9486b38c345a3ac3a8e971d32

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rest-assured-0.2.0.rc4 lib/rest-assured/routes/response.rb