Skip to content

Fairing for internally normalizing request URIs#345

Open
jasonyess wants to merge 1 commit intostadust:masterfrom
jasonyess:uri-normalizer
Open

Fairing for internally normalizing request URIs#345
jasonyess wants to merge 1 commit intostadust:masterfrom
jasonyess:uri-normalizer

Conversation

@jasonyess
Copy link
Copy Markdown
Contributor

adds a fairing which appends a trailing slash (if needed) to incoming requests, but only for route handlers whose URIs have a trailing slash (so if the route is #[rocket::get("/foo")] the fairing won't do anything)
this fairing will not add a trailing slash if the request is attempting to fetch static files, since it only modifies requests which are trying to reach one of our route handlers

this eliminates the need for some server config and also keeps behavior consistent between both variants, with and without a trailing slash

i found this useful for my local environment so i figured i'll open a pr 🙃 there are a handful of things that point to uris without the trailing slash so this fixes the nuisance

License Acceptance

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 0% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.55%. Comparing base (3734d28) to head (2086293).

Files with missing lines Patch % Lines
pointercrate-core-api/src/normalize_uri.rs 0.00% 26 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #345      +/-   ##
==========================================
- Coverage   35.71%   35.55%   -0.16%     
==========================================
  Files         121      122       +1     
  Lines        5886     5912      +26     
==========================================
  Hits         2102     2102              
- Misses       3784     3810      +26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant