Skip to content

Conversation

@swhitty
Copy link
Owner

@swhitty swhitty commented Nov 23, 2023

Adds support for parsing requests with percent encoded paths.

Routes can be added including spaces:

server.appendRoute("/fish & chips") { _ in
  HTTPResponse(
    statusCode: .ok,
    headers: [.contentType: "text/plain; charset=UTF-8"],
    body: "🐟🍟".data(using: .utf8)!
  )
}

Requests are decoded and matched against the unescaped Routes:

% curl "localhost/fish%20&%20chips"
🐟🍟

Resolves #74

@codecov
Copy link

codecov bot commented Nov 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (148e228) 99.77% compared to head (d8fac8f) 99.77%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #75   +/-   ##
=======================================
  Coverage   99.77%   99.77%           
=======================================
  Files          47       47           
  Lines        2675     2684    +9     
=======================================
+ Hits         2669     2678    +9     
  Misses          6        6           

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

@swhitty swhitty merged commit 688c690 into main Nov 23, 2023
@swhitty swhitty deleted the percent-encoded-path branch November 23, 2023 11:03
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.

URLs with spaces do not work

2 participants