Class: Rack::Cache::Request
- Inherits:
-
Request
- Object
- Request
- Rack::Cache::Request
- Defined in:
- lib/rack/cache/request.rb
Overview
Provides access to the HTTP request. The request
and original_request
objects exposed by the Core caching engine are instances of this class.
Request objects respond to a variety of convenience methods, including everything defined by Rack::Request as well as the Headers and RequestHeaders modules.
Instance Method Summary collapse
-
#cache_control ⇒ Object
A CacheControl instance based on the request’s cache-control header.
-
#no_cache? ⇒ Boolean
True when the cache-control/no-cache directive is present or the Pragma header is set to no-cache.
-
#request_method ⇒ Object
The HTTP request method.
Instance Method Details
#cache_control ⇒ Object
A CacheControl instance based on the request’s cache-control header.
22 23 24 |
# File 'lib/rack/cache/request.rb', line 22 def cache_control @cache_control ||= CacheControl.new(env['HTTP_CACHE_CONTROL']) end |
#no_cache? ⇒ Boolean
True when the cache-control/no-cache directive is present or the Pragma header is set to no-cache.
28 29 30 31 |
# File 'lib/rack/cache/request.rb', line 28 def no_cache? cache_control['no-cache'] || env['HTTP_PRAGMA'] == 'no-cache' end |
#request_method ⇒ Object
The HTTP request method. This is the standard implementation of this method but is respecified here due to libraries that attempt to modify the behavior to respect POST tunnel method specifiers. We always want the real request method.
17 18 19 |
# File 'lib/rack/cache/request.rb', line 17 def request_method @env['REQUEST_METHOD'] end |