Class: HTTP::Session::Context::FollowContext
- Inherits:
-
Object
- Object
- HTTP::Session::Context::FollowContext
- Defined in:
- lib/http/session/context/follow_context.rb
Instance Method Summary collapse
- #cross_origin? ⇒ Boolean
-
#initialize(opts) ⇒ FollowContext
constructor
A new instance of FollowContext.
- #same_origin? ⇒ Boolean
- #should_drop_body? ⇒ Boolean
Constructor Details
#initialize(opts) ⇒ FollowContext
Returns a new instance of FollowContext.
4 5 6 7 8 |
# File 'lib/http/session/context/follow_context.rb', line 4 def initialize(opts) @request = opts[:request] @verb = opts[:verb] @uri = opts[:uri] end |
Instance Method Details
#cross_origin? ⇒ Boolean
14 15 16 |
# File 'lib/http/session/context/follow_context.rb', line 14 def cross_origin? !same_origin? end |
#same_origin? ⇒ Boolean
10 11 12 |
# File 'lib/http/session/context/follow_context.rb', line 10 def same_origin? @request.uri.origin == @uri.origin end |
#should_drop_body? ⇒ Boolean
18 19 20 21 |
# File 'lib/http/session/context/follow_context.rb', line 18 def should_drop_body? @verb == :get && HTTP::Session::Redirector::UNSAFE_VERBS.include?(@request.verb) end |