Class: ProxyStack.self::Controller

Inherits:
Object
  • Object
show all
Defined in:
lib/proxy_stack/proxy_stack.rb

Instance Method Summary collapse

Instance Method Details

#dispatch!Object



76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/proxy_stack/proxy_stack.rb', line 76

def dispatch!
  begin
    result = super
    if result[0] == 404
      Rack::Response.new(proxy_request, status, headers).finish
    else
      result
    end
  rescue Pancake::Errors::NotFound
    Rack::Response.new(proxy_request, status, headers).finish
  end
end

#log_http_error?(error) ⇒ Boolean

Returns:

  • (Boolean)


89
90
91
92
93
94
95
96
# File 'lib/proxy_stack/proxy_stack.rb', line 89

def log_http_error?(error)
  case error
  when Pancake::Errors::NotFound
    false
  else
    true
  end
end

#proxy_requestObject



69
70
71
72
73
74
# File 'lib/proxy_stack/proxy_stack.rb', line 69

def proxy_request
  execute_blocks!(self.class.before_proxy)
  @proxy_result = proxy_request!
  execute_blocks!(self.class.after_proxy)
  @proxy_result
end