Skip to content

Conversation

@swhitty
Copy link
Owner

@swhitty swhitty commented Nov 8, 2025

Adds HTTPRequest.target to preserve the raw path and query string from the request as per RFC9112 allowing access to either percent encoded or the original raw path / query string.

resolves #175

A request like so;

GET /hello%20world?fish=%2Fchips HTTP/1.1

Produces the following HTTPRequest:

request.path == "/hello world"
request.target.path() == "/hello%20world"
request.target.path(percentEncoded: false) == "/hello world"

request.query == [QueryItem(name: "fish", value="/chips"]
request.target.query() == "fish=%2Fchips"
request.target.query(percentEncoded: false) == "fish=/chips"

@codecov
Copy link

codecov bot commented Nov 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.03%. Comparing base (29fffbd) to head (fb8a62b).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #179      +/-   ##
==========================================
+ Coverage   92.67%   93.03%   +0.36%     
==========================================
  Files          68       69       +1     
  Lines        3412     3445      +33     
==========================================
+ Hits         3162     3205      +43     
+ Misses        250      240      -10     

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

@swhitty swhitty force-pushed the HTTPRequest+Target branch 2 times, most recently from 6bac85c to ab1b09a Compare November 8, 2025 07:10
@swhitty swhitty force-pushed the HTTPRequest+Target branch from ab1b09a to fb8a62b Compare November 8, 2025 07:19
@swhitty swhitty merged commit 73a4da5 into main Nov 8, 2025
23 of 24 checks passed
@swhitty swhitty deleted the HTTPRequest+Target branch November 8, 2025 07:24
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.

HTTPRequest.path does not preserve percent-escaping

2 participants