Class: Tzispa::Http::Request
- Inherits:
-
Rack::Request
- Object
- Rack::Request
- Tzispa::Http::Request
- Defined in:
- lib/tzispa/http/request.rb
Constant Summary collapse
- ALLOWED_HTTP_VERSIONS =
['HTTP/1.1', 'HTTP/2.0'].freeze
- HTTP_X_FORWARDED_HOST =
'HTTP_X_FORWARDED_HOST'- REQUEST_METHOD =
Rack::REQUEST_METHOD
Instance Method Summary collapse
- #allowed_http_version? ⇒ Boolean
- #forwarded? ⇒ Boolean
- #http_version ⇒ Object
- #idempotent? ⇒ Boolean
- #link? ⇒ Boolean
- #safe? ⇒ Boolean
- #unlink? ⇒ Boolean
Instance Method Details
#allowed_http_version? ⇒ Boolean
25 26 27 |
# File 'lib/tzispa/http/request.rb', line 25 def allowed_http_version? ALLOWED_HTTP_VERSIONS.include? http_version end |
#forwarded? ⇒ Boolean
17 18 19 |
# File 'lib/tzispa/http/request.rb', line 17 def forwarded? env.include? HTTP_X_FORWARDED_HOST end |
#http_version ⇒ Object
21 22 23 |
# File 'lib/tzispa/http/request.rb', line 21 def http_version env['HTTP_VERSION'] end |
#idempotent? ⇒ Boolean
33 34 35 |
# File 'lib/tzispa/http/request.rb', line 33 def idempotent? safe? || put? || delete? || link? || unlink? end |
#link? ⇒ Boolean
37 38 39 |
# File 'lib/tzispa/http/request.rb', line 37 def link? request_method == 'LINK' end |
#safe? ⇒ Boolean
29 30 31 |
# File 'lib/tzispa/http/request.rb', line 29 def safe? get? || head? || || trace? end |
#unlink? ⇒ Boolean
41 42 43 |
# File 'lib/tzispa/http/request.rb', line 41 def unlink? request_method == 'UNLINK' end |