daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class MyMiddleware
  2.   def initialize(app)
  3.     @app = app
  4.     @message = message
  5.   end
  6.  
  7.   def call(env)
  8.     dup._call(env)
  9.   end
  10.  
  11.   def _call(env)
  12.     _, script_name, request_path = env['REQUEST_PATH'].split('/', 3)
  13.     env['SCRIPT_NAME'] = '/' + script_name
  14.     env['PATH_INFO'] = '/' + request_path
  15.     env['REQUEST_PATH'] = '/' + request_path
  16.     env['REQUEST_URI'] = '/' + request_path
  17.     @status, @headers, @response = @app.call(env)
  18.     [@status, @headers, self]
  19.   end
  20.  
  21.   def each(&block)
  22.     @response.each(&block)
  23.   end
  24. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top