Skip to content

vweb: avoid the controllers needs to be defined in specific order#19182

Merged
medvednikov merged 1 commit intovlang:masterfrom
Dracks:master
Aug 19, 2023
Merged

vweb: avoid the controllers needs to be defined in specific order#19182
medvednikov merged 1 commit intovlang:masterfrom
Dracks:master

Conversation

@Dracks
Copy link
Copy Markdown
Contributor

@Dracks Dracks commented Aug 19, 2023

This P/R allows the use of the controllers in VWeb without need to worry about the order in which you put them in the list.

This should avoid user errors, and make it more easy to use VWeb controllers.

🤖 Generated by Copilot at 27c00f0

This pull request improves the vweb routing logic by fixing a bug and adding a new controller and test cases. It sorts the controllers by path length and checks for duplicate or conflicting paths. It also adds the OtherHidedByOther controller and tests it with the /other/hide and /other/hide/path routes.

🤖 Generated by Copilot at 27c00f0

  • Fix a bug where controllers with longer paths could be shadowed by controllers with shorter paths that match a prefix of the longer path (link,link,link,link,link,link)
  • Add a new struct OtherHidedByOther to test the routing logic (link,link,link,link)

@medvednikov medvednikov requested a review from Casper64 August 19, 2023 09:03
@medvednikov medvednikov merged commit c9e6c67 into vlang:master Aug 19, 2023
@medvednikov
Copy link
Copy Markdown
Member

A great fix, thanks!

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.

3 participants