Skip to content

feat(trailing-slash): add skip option#4862

Merged
yusukebe merged 1 commit intomainfrom
feat/trailing-slash-skip
Apr 15, 2026
Merged

feat(trailing-slash): add skip option#4862
yusukebe merged 1 commit intomainfrom
feat/trailing-slash-skip

Conversation

@yusukebe
Copy link
Copy Markdown
Member

@yusukebe yusukebe commented Apr 6, 2026

This PR adds a skip option to Trailing Slash Middleware. This option is useful if the user wants to add the rule to skip the redirect depending on the path. For example, to skip the redirect if the path has an extension, you can write like this:

app.use(
  appendTrailingSlash({
    skip: (path) => /\.\w+$/.test(path),
  })
)

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 6, 2026

Bundle size check

main (f82aba8) #4862 (2bc90a7) +/-
Bundle Size (B) 18,489B 18,489B 0B
Bundle Size (KB) 18.06K 18.06K 0K

Compiler Diagnostics (tsc)

main (f82aba8) #4862 (2bc90a7) +/-
Files 229 229 0
Lines 146,731 146,731 0
Identifiers 124,420 124,420 0
Symbols 150,583 150,583 0
Types 157,112 157,112 0
Instantiations 401,446 401,446 0
Memory used 252,555K 252,402K -153K
I/O read 0.03s 0.02s -0.01s
I/O write 0s 0s 0s
Parse time 0.73s 0.75s 0.02s
Bind time 0.28s 0.28s 0s
Check time 1.52s 1.51s -0.01s
Emit time 0.01s 0.01s 0s
Total time 2.54s 2.55s 0.01s

Compiler Diagnostics (typescript-go)

main (f82aba8) #4862 (2bc90a7) +/-
Files 229 229 0
Lines 150,912 150,912 0
Identifiers 125,098 125,098 0
Symbols 190,886 190,886 0
Types 255,496 255,496 0
Instantiations 608,997 608,997 0
Memory used 162,235K 162,134K -101K
Memory allocs 1,768,314 1,767,710 -604
Config time 0.001s 0.001s 0s
BuildInfo read time 0.001s 0.001s 0s
Parse time 0.097s 0.095s -0.002s
Bind time 0s 0s 0s
Check time 0.471s 0.455s -0.016s
Emit time 0.004s 0.005s 0.001s
Changes compute time 0.036s 0.026s -0.01s
Total time 0.647s 0.622s -0.025s

Reported by octocov

@yusukebe
Copy link
Copy Markdown
Member Author

yusukebe commented Apr 6, 2026

Hey @dai-shi ! What do you think of this? Can this satisfy your needs?

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 6, 2026

HTTP Performance Benchmark

Framework Runtime Average Ping Query Body
hono (origin/main) bun 37,766.51 52,533.13 33,316.74 27,449.66
hono (current) bun 38,208.03 53,614.34 33,447.99 27,561.76
Change +1.17% +2.06% +0.39% +0.41%

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.87%. Comparing base (f82aba8) to head (d39b520).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4862   +/-   ##
=======================================
  Coverage   92.87%   92.87%           
=======================================
  Files         177      177           
  Lines       11726    11731    +5     
  Branches     3488     3493    +5     
=======================================
+ Hits        10890    10895    +5     
  Misses        835      835           
  Partials        1        1           

☔ 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.

Copy link
Copy Markdown

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

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

LGTM

@yusukebe
Copy link
Copy Markdown
Member Author

yusukebe commented Apr 7, 2026

@dai-shi Thanks!

Hey @usualoma Can you review this? I think this feature is good.

@yusukebe yusukebe merged commit f23e97b into main Apr 15, 2026
20 checks passed
@yusukebe yusukebe deleted the feat/trailing-slash-skip branch April 15, 2026 05:22
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.

2 participants