Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyMiddleware
- def initialize(app)
- @app = app
- @message = message
- end
- def call(env)
- dup._call(env)
- end
- def _call(env)
- _, script_name, request_path = env['REQUEST_PATH'].split('/', 3)
- env['SCRIPT_NAME'] = '/' + script_name
- env['PATH_INFO'] = '/' + request_path
- env['REQUEST_PATH'] = '/' + request_path
- env['REQUEST_URI'] = '/' + request_path
- @status, @headers, @response = @app.call(env)
- [@status, @headers, self]
- end
- def each(&block)
- @response.each(&block)
- end
- end
Add Comment
Please, Sign In to add comment