123456789_123456789_123456789_123456789_123456789_

Exception: Rack::ForwardRequest

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Exception
Instance Chain:
self, Exception
Inherits: Exception
  • Object
Defined in: lib/rack/recursive.rb

Overview

ForwardRequest gets caught by Recursive and redirects the current request to the app at #url.

raise ForwardRequest.new("/not-found")

Class Method Summary

Instance Attribute Summary

Constructor Details

.new(url, env = {}) ⇒ ForwardRequest

[ GitHub ]

  
# File 'lib/rack/recursive.rb', line 17

def initialize(url, env = {})
  @url = URI(url)
  @env = env

  @env[PATH_INFO]       = @url.path
  @env[QUERY_STRING]    = @url.query  if @url.query
  @env[HTTP_HOST]       = @url.host   if @url.host
  @env[HTTP_PORT]       = @url.port   if @url.port
  @env[RACK_URL_SCHEME] = @url.scheme if @url.scheme

  super "forwarding to #{url}"
end

Instance Attribute Details

#env (readonly)

[ GitHub ]

  
# File 'lib/rack/recursive.rb', line 15

attr_reader :url, :env

#url (readonly)

[ GitHub ]

  
# File 'lib/rack/recursive.rb', line 15

attr_reader :url, :env