Add request methods to the Rage::Request class. #97
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Request Methods
Description
This PR adds four new methods to the
Rage::Request
class to enhance its functionality. The methods added areurl
,path
,fullpath
, anduser_agent
.Issue Addressed
Issue: Add request methods
The
Rage::Request
class needs additional methods to provide more detailed information about the request. These methods include:url
: Returns the full URL of the request.path
: Returns the path of the request.fullpath
: Returns the full path including the query string.user_agent
: Returns the user agent of the request by looking at theHTTP_USER_AGENT
header.Changes Made
url
Method:request.url => "http://localhost:3000/users?show_archived=true"
path
Method:request.path => "/users"
fullpath
Method:request.fullpath => "/users?show_archived=true"
user_agent
Method:HTTP_USER_AGENT
header.request.user_agent => "Mozilla/5.0 (Macintosh; ..."
RSpec Test:
Documentation
Examples for each method have been added to the Rage::Request class.