Sha256: 48cc0e5e769d66e38097e9a0740a384079e16195444cb011327253c0678763bb
Contents?: true
Size: 877 Bytes
Versions: 4
Compression:
Stored size: 877 Bytes
Contents
module Mirage class Server < Sinatra::Base # TODO write tests to check that all of these verbs are supported %w(get post delete put options head).each do |http_method| send(http_method, '/responses/*') do |name| body, query_string = request.body.read.to_s, request.query_string options = {:body => body, :http_method => http_method, :endpoint => name, :params => request.params, :headers => extract_http_headers(env)} begin record = MockResponse.find(options) rescue ServerResponseNotFound record = MockResponse.find_default(options) end synchronize do tracked_requests(record.response_id) << request.dup end send_response(record, body, request, query_string) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems