Exception: Rack::ForwardRequest

Inherits:
Exception show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rack-2.2.5/lib/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

Methods inherited from Exception

#as_json

Constructor Details

#initialize(url, env = {}) ⇒ ForwardRequest

Returns a new instance of ForwardRequest.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rack-2.2.5/lib/rack/recursive.rb', line 15

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

#envObject (readonly)

Returns the value of attribute env.



13
14
15
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rack-2.2.5/lib/rack/recursive.rb', line 13

def env
  @env
end

#urlObject (readonly)

Returns the value of attribute url.



13
14
15
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rack-2.2.5/lib/rack/recursive.rb', line 13

def url
  @url
end