Exception: Rack::ForwardRequest

Inherits:
Exception
  • Object
show all
Defined in:
rack/rack/recursive.rb

Overview

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

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

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (ForwardRequest) initialize(url, env = {})

Returns a new instance of ForwardRequest



13
14
15
16
17
18
19
20
21
22
23
24
# File 'rack/rack/recursive.rb', line 13

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

- (void) env (readonly)

Returns the value of attribute env



11
12
13
# File 'rack/rack/recursive.rb', line 11

def env
  @env
end

- (void) url (readonly)

Returns the value of attribute url



11
12
13
# File 'rack/rack/recursive.rb', line 11

def url
  @url
end