Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add request methods to the Rage::Request class. #97

Merged
merged 3 commits into from
Aug 14, 2024

Conversation

cuneyter
Copy link
Member

Add Request Methods

Description

This PR adds four new methods to the Rage::Request class to enhance its functionality. The methods added are url, path, fullpath, and user_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 the HTTP_USER_AGENT header.

Changes Made

  1. url Method:

    • Returns the full URL of the request.
    • Example: request.url => "http://localhost:3000/users?show_archived=true"
  2. path Method:

    • Returns the path of the request.
    • Example: request.path => "/users"
  3. fullpath Method:

    • Returns the full path including the query string.
    • Example: request.fullpath => "/users?show_archived=true"
  4. user_agent Method:

    • Returns the user agent of the request by looking at the HTTP_USER_AGENT header.
    • Example: request.user_agent => "Mozilla/5.0 (Macintosh; ..."
  5. RSpec Test:

    • Added tests to check if the methods are returning the expected result.

Documentation

Examples for each method have been added to the Rage::Request class.

@cuneyter cuneyter requested a review from rsamoilov August 10, 2024 12:49
Co-authored-by: Roman Samoilov <2270393+rsamoilov@users.noreply.github.com>
@cuneyter cuneyter requested a review from rsamoilov August 14, 2024 09:55
Copy link
Member

@rsamoilov rsamoilov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@rsamoilov rsamoilov merged commit 7858743 into master Aug 14, 2024
6 checks passed
@rsamoilov rsamoilov deleted the add-request-methods branch August 14, 2024 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants