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

web: add HttpRequest::full_url() #3096

Merged
merged 5 commits into from
Jun 10, 2024

Conversation

TimoCak
Copy link
Contributor

@TimoCak TimoCak commented Aug 2, 2023

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt.
  • (Team) Label with affected crates and semver status.

Overview

Hi Guys,

i implemented a new method called full_uri() for the HttpRequest Type. To get the full uri of a request since the already existing method uri() does not have this functionality.
It seemed to me like an easy solution to get informations which will be provided from HttpRequest methods.
So i used the connection_info() method to extract the scheme and the host from the Request.
The origin can be provided by the uri() method.
I used the Uri::builder() to form the return value of the method.

I tested it with a simple handler which returns the uri:

grafik
grafik

Thats basically it. If there is any information missing, please let me know!

Cheers,

Timo

Closes #2895

@robjtede robjtede added B-semver-minor A-web project: actix-web labels Aug 3, 2023
@robjtede robjtede added this to the actix-web v4.5 milestone Aug 3, 2023
@robjtede robjtede removed this from the actix-web v4.5 milestone Feb 4, 2024
@robjtede robjtede changed the title implemented function which returns full uri web: add HttpRequest::full_url() Jun 10, 2024
Copy link
Member

@robjtede robjtede left a comment

Choose a reason for hiding this comment

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

Made some tweaks to name and return type.

Thanks for getting this started, 👍🏻

@robjtede robjtede enabled auto-merge June 10, 2024 02:38
@robjtede robjtede added this pull request to the merge queue Jun 10, 2024
Merged via the queue into actix:master with commit 7a2313c Jun 10, 2024
13 checks passed
@joepio
Copy link

joepio commented Jun 17, 2024

Thank you for this! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-web project: actix-web B-semver-minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request.uri() returns the Path instead of the full URL
3 participants