Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: medz/routingkit
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.0.0
Choose a base ref
...
head repository: medz/routingkit
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.0.1
Choose a head ref
  • 4 commits
  • 14 files changed
  • 1 contributor

Commits on Mar 3, 2025

  1. Enhance HTTP method normalization and route handling

    - Implement case-insensitive HTTP method normalization
    - Add support for complex format parameter patterns like ':filename.:format?'
    - Improve route matching priority and handling of parameter routes
    - Refactor route finding and collection logic for better performance and clarity
    - Update README with HTTP method normalization example
    medz committed Mar 3, 2025
    Copy the full SHA
    8b95e9b View commit details
  2. Add configurable anyMethodToken for flexible route matching

    - Introduce configurable anyMethodToken in Router constructor
    - Update route matching and handling to use custom or default anyMethodToken
    - Add tests for custom and default anyMethodToken behavior
    - Improve route matching flexibility for null/wildcard method routes
    medz committed Mar 3, 2025
    Copy the full SHA
    d1c8715 View commit details
  3. Prevent duplicate route matches in router implementation

    - Refactor route matching to avoid duplicate route entries
    - Add unique route tracking mechanism in findAll method
    - Modify _collectMatchesNonStatic to skip already processed static routes
    - Improve route matching performance and result consistency
    - Update test case to verify non-duplicate route matching
    medz committed Mar 3, 2025
    Copy the full SHA
    69c9a44 View commit details
  4. Release 5.0.1: Fix findAll duplication, add anyMethodToken

    medz committed Mar 3, 2025
    Copy the full SHA
    99d92d3 View commit details
Showing with 1,107 additions and 1,253 deletions.
  1. +8 −0 CHANGELOG.md
  2. +14 −0 README.md
  3. +457 −254 lib/src/router.dart
  4. +1 −1 pubspec.yaml
  5. +0 −210 test/advanced_test.dart
  6. +0 −216 test/basic_test.dart
  7. +0 −145 test/delete_test.dart
  8. +117 −0 test/edge_cases_test.dart
  9. +104 −0 test/http_method_test.dart
  10. +0 −167 test/performance_and_edge_test.dart
  11. +128 −0 test/performance_test.dart
  12. +119 −0 test/route_management_test.dart
  13. +0 −260 test/router_management_test.dart
  14. +159 −0 test/router_test.dart
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 5.0.1

### Bug Fixes

- Fixed duplicated results in `findAll` method by implementing a deduplication mechanism
- Added configurable `anyMethodToken` parameter to `createRouter` function with a default value of 'routerkit-method://any'
- Enhanced wildcard and parameter matching with more reliable route priority handling

## 5.0.0

### Breaking Changes
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -111,6 +111,20 @@ router.remove('GET', '/users/:id');
router.remove('POST', null);
```

### HTTP Method Handling

RoutingKit automatically normalizes HTTP methods to uppercase. This means that methods like 'get', 'GET', or 'Get' are all treated as 'GET'. This follows the HTTP specification and makes the router more robust.

```dart
router.add('get', '/users', 'get-users'); // Will be normalized to 'GET'
router.add('POST', '/users', 'post-users'); // Will be normalized to 'POST'
// All these will match the same route
router.find('get', '/users'); // Matches
router.find('GET', '/users'); // Matches
router.find('Get', '/users'); // Matches
```

## Example Applications

### HTTP Server Routing
Loading