Skip to content

Conversation

swhitty
Copy link
Owner

@swhitty swhitty commented Sep 13, 2025

Updates HTTPRedirectHandler to dynamically redirect via a base URL

await server.appendRoute("GET /fish/*", to: .redirect(via: "https://pie.dev"))
// GET /fish/chips  --->  HTTP 301
//                        Location: https://pie.dev/fish/chips

Providing a serverPath allows for the removal of a prefix before redirecting:

await server.appendRoute("GET /fish/*", to: .redirect(via: "https://pie.dev", serverPath: "/fish"))
// GET /fish/chips  --->  HTTP 301
//                        Location: https://pie.dev/chips

Copy link

codecov bot commented Sep 13, 2025

Codecov Report

❌ Patch coverage is 95.89041% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.94%. Comparing base (d18c833) to head (0b19c86).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...yingFox/Sources/Handlers/RedirectHTTPHandler.swift 95.71% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #174      +/-   ##
==========================================
+ Coverage   92.85%   92.94%   +0.08%     
==========================================
  Files          64       64              
  Lines        4366     4435      +69     
==========================================
+ Hits         4054     4122      +68     
- Misses        312      313       +1     

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

@swhitty swhitty linked an issue Sep 13, 2025 that may be closed by this pull request
@swhitty swhitty merged commit 1f5c2ea into main Sep 13, 2025
24 checks passed
@swhitty swhitty deleted the redirect-via branch September 13, 2025 07:58
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.

Feature request: dynamic redirect
1 participant