Module: Tilia::Http::RequestInterface
- Includes:
- MessageInterface
- Included in:
- Request, RequestDecorator
- Defined in:
- lib/tilia/http/request_interface.rb
Overview
The RequestInterface represents a HTTP request.
Instance Method Summary collapse
-
#absolute_url ⇒ String
Returns the absolute url.
-
#absolute_url=(_url) ⇒ void
Sets the absolute url.
-
#base_url ⇒ String
Returns the current base url.
-
#base_url=(_url) ⇒ void
Sets a base url.
-
#method ⇒ String
Returns the current HTTP method.
-
#method=(_method) ⇒ void
Sets the HTTP method.
-
#path ⇒ String
Returns the relative path.
-
#post_data ⇒ Object
Returns the POST data.
-
#post_data=(_post_data) ⇒ void
Sets the post data.
-
#query_parameters ⇒ Object
Returns the list of query parameters.
-
#raw_server_data=(_data) ⇒ void
Sets the _SERVER array.
-
#raw_server_value(_value_name) ⇒ String?
Returns an item from the _SERVER array.
-
#url ⇒ String
Returns the request url.
-
#url=(_url) ⇒ void
Sets the request url.
Methods included from MessageInterface
#add_header, #add_headers, #body, #body=, #body_as_stream, #body_as_string, #header, #header?, #header_as_array, #headers, #http_version, #http_version=, #remove_header, #update_header, #update_headers
Instance Method Details
#absolute_url ⇒ String
Returns the absolute url.
36 37 |
# File 'lib/tilia/http/request_interface.rb', line 36 def absolute_url end |
#absolute_url=(_url) ⇒ void
This method returns an undefined value.
Sets the absolute url.
43 44 |
# File 'lib/tilia/http/request_interface.rb', line 43 def absolute_url=(_url) end |
#base_url ⇒ String
Returns the current base url.
49 50 |
# File 'lib/tilia/http/request_interface.rb', line 49 def base_url end |
#base_url=(_url) ⇒ void
This method returns an undefined value.
Sets a base url.
This url is used for relative path calculations.
The base url should default to /
60 61 |
# File 'lib/tilia/http/request_interface.rb', line 60 def base_url=(_url) end |
#method ⇒ String
Returns the current HTTP method
10 11 |
# File 'lib/tilia/http/request_interface.rb', line 10 def method end |
#method=(_method) ⇒ void
This method returns an undefined value.
Sets the HTTP method
17 18 |
# File 'lib/tilia/http/request_interface.rb', line 17 def method=(_method) end |
#path ⇒ String
Returns the relative path.
This is being calculated using the base url. This path will not start with a slash, so it will always return something like ‘example/path.html’.
If the full path is equal to the base url, this method will return an empty string.
This method will also urldecode the path, and if the url was incoded as ISO-8859-1, it will convert it to UTF-8.
If the path is outside of the base url, a LogicException will be thrown.
78 79 |
# File 'lib/tilia/http/request_interface.rb', line 78 def path end |
#post_data ⇒ Object
Returns the POST data.
This is equivalent to PHP’s $_POST superglobal.
94 95 |
# File 'lib/tilia/http/request_interface.rb', line 94 def post_data end |
#post_data=(_post_data) ⇒ void
This method returns an undefined value.
Sets the post data.
This is equivalent to PHP’s $_POST superglobal.
This would not have been needed, if POST data was accessible as php://input, but unfortunately we need to special case it.
106 107 |
# File 'lib/tilia/http/request_interface.rb', line 106 def post_data=(_post_data) end |
#query_parameters ⇒ Object
Returns the list of query parameters.
This is equivalent to PHP’s $_GET superglobal.
86 87 |
# File 'lib/tilia/http/request_interface.rb', line 86 def query_parameters end |
#raw_server_data=(_data) ⇒ void
This method returns an undefined value.
Sets the _SERVER array.
122 123 |
# File 'lib/tilia/http/request_interface.rb', line 122 def raw_server_data=(_data) end |
#raw_server_value(_value_name) ⇒ String?
Returns an item from the _SERVER array.
If the value does not exist in the array, null is returned.
115 116 |
# File 'lib/tilia/http/request_interface.rb', line 115 def raw_server_value(_value_name) end |
#url ⇒ String
Returns the request url.
23 24 |
# File 'lib/tilia/http/request_interface.rb', line 23 def url end |
#url=(_url) ⇒ void
This method returns an undefined value.
Sets the request url.
30 31 |
# File 'lib/tilia/http/request_interface.rb', line 30 def url=(_url) end |