Make rack request object available in template rendering. Closes #1532

This commit is contained in:
Thomas Reynolds 2015-06-01 11:12:34 -07:00
parent bca04841fe
commit 81a77828bd

View file

@ -73,8 +73,9 @@ module Middleman
# message. # message.
# #
# @param env # @param env
# @param [Rack::Request] req
# @param [Rack::Response] res # @param [Rack::Response] res
def process_request(env, _, res) def process_request(env, req, res)
start_time = Time.now start_time = Time.now
request_path = URI.decode(env['PATH_INFO'].dup) request_path = URI.decode(env['PATH_INFO'].dup)
@ -100,7 +101,7 @@ module Middleman
begin begin
# Write out the contents of the page # Write out the contents of the page
res.write resource.render res.write resource.render({}, { rack: { request: req } })
# Valid content is a 200 status # Valid content is a 200 status
res.status = 200 res.status = 200