Skip to content

Added wildcard feature#586

Draft
dharshan-0 wants to merge 18 commits into
cot-rs:masterfrom
dharshan-0:wildcard-feature
Draft

Added wildcard feature#586
dharshan-0 wants to merge 18 commits into
cot-rs:masterfrom
dharshan-0:wildcard-feature

Conversation

@dharshan-0

@dharshan-0 dharshan-0 commented Jun 3, 2026

Copy link
Copy Markdown

Related issue or discussion

Description

It closes #545 by adding wildcard routing feature.

It uses this {*param_name} to define wildcard.

Route::with_handler_and_name("/random/{*path}", generate_random, "generate-random"),

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / cleanup
  • Performance improvement
  • Other (describe above)

Checklist

  • I've read the contributing guide
  • Tests pass locally (just test-all)
  • Code passes clippy (just clippy)
  • Code is properly formatted (cargo fmt)
  • New tests added (regression test for bugs, coverage for new features)
  • Documentation (both code and site) updated (if applicable)

@github-actions github-actions Bot added A-docs Area: Documentation C-lib Crate: cot (main library crate) labels Jun 3, 2026
@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.18182% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cot/src/router/path.rs 98.18% 0 Missing and 1 partial ⚠️
Flag Coverage Δ
rust 90.26% <98.18%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cot/src/router/path.rs 99.39% <98.18%> (-0.26%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ElijahAhianyo ElijahAhianyo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@dharshan-0 Thanks a lot for your contribution. This is a great start! Let's address the comments, and it's good to merge.

Comment thread cot/src/router/path.rs Outdated
Comment thread cot/src/router/path.rs Outdated
Comment thread cot/src/router/path.rs Outdated
Comment thread cot/src/router/path.rs Outdated
@dharshan-0

dharshan-0 commented Jun 8, 2026

Copy link
Copy Markdown
Author

@ElijahAhianyo Thanks for your comments, I will look into it.

@dharshan-0 dharshan-0 marked this pull request as draft June 8, 2026 16:30
@dharshan-0 dharshan-0 marked this pull request as ready for review June 10, 2026 07:52
@dharshan-0 dharshan-0 requested a review from ElijahAhianyo June 10, 2026 07:53
Comment thread cot/src/router/path.rs
Comment thread cot/src/router/path.rs Outdated

@ElijahAhianyo ElijahAhianyo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@dharshan-0 Thanks for your contribution once again!

@seqre seqre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall, it's a great job, thank you for your contribution!

I see one possible clash with overlapping routes, eg. /foo/{*path} and /foo/bar. To be honest, I'm not sure which route the framework would use atm. I think that it should first use the qualified path if it exists, and if it doesn't, then match the wildcard one.

I'd like for you to add a test(s) checking that functionality (also with different ordering of route definition in Router::with_urls) and if it does not work like that, to adapt the code. Also, mention that in the documentation, please.

Once that's done, I'll be happy to approve!

@dharshan-0

Copy link
Copy Markdown
Author

Thats a valid point, I will look into that

@dharshan-0 dharshan-0 marked this pull request as draft June 24, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-docs Area: Documentation C-lib Crate: cot (main library crate)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Wildcard in Routes

3 participants