Sha256: 91b3adc8eb135026e8875745779a6ae36206bd2057cccc06ac8e97abea11c012
Contents?: true
Size: 1.17 KB
Versions: 4
Compression:
Stored size: 1.17 KB
Contents
require 'webmachine/request' require 'webmachine/adapters/rack' # Monkey patch to make the Rack env available on the Webmachine Request object module Webmachine class RackRequest < Webmachine::Request attr_reader :env def initialize(method, uri, headers, body, routing_tokens, base_uri, env) super(method, uri, headers, body, routing_tokens, base_uri) @env = env end end end unless Webmachine::Adapters::Rack.private_instance_methods.include?(:build_webmachine_request) raise "Webmachine::Adapters::Rack no longer has the private instance method #build_webmachine_request - rack env monkey patch won't work" end module Webmachine module Adapters class Rack < Adapter private def build_webmachine_request(rack_req, headers) Webmachine::RackRequest.new(rack_req.request_method, rack_req.url, headers, RequestBody.new(rack_req), routing_tokens(rack_req), base_uri(rack_req), rack_req.env ) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems