Skip to main content

shelf_router 1.1.5 copy "shelf_router: ^1.1.5" to clipboard
shelf_router: ^1.1.5 copied to clipboard

A convenient request router for the shelf web-framework, with support for URL-parameters, nested routers and routers generated from source annotations.

1.1.5 #

  • Match parameterless routes by string comparison instead of executing their compiled pattern. A route with no <param> segments compiles to ^ plus an escaped literal plus $, which matches exactly one string, so the regex execution on every request to a static route was redundant.
  • Optimize Router matching with a prefix Trie filter for static path segments.
  • Fixed automatic HEAD request handling to not modify content-length.
  • Require Dart ^3.9.0.

1.1.4 #

  • Fixed a spelling issue in the pubspec file.
  • Added package topics to the pubspec file.
  • Require Dart >=2.17.

1.1.3 #

  • Update the pubspec repository field.

1.1.2 #

  • Remove trailing slash requirement when using mount.

1.1.1 #

  • Fix Router.routeNotFound to enable multiple read() calls on it.

1.1.0 #

  • params is deprecated in favor of Request.params adding using an extension on Request.
  • The default notFoundHandler now returns a sentinel routeNotFound response object which causes 404 with the message 'Route not found'.
  • Minor breaking: Handlers and sub-routers that return the sentinel routeNotFound response object will be ignored and pattern matching will continue on additional routes/handlers.

Changing the router to continue pattern matching additional routes if a matched handler or nested router returns the sentinel routeNotFound response object is technically a breaking change. However, it only affects scenarios where the request matches a mounted sub-router, but does not match any route on this sub-router. In this case, shelf_router version 1.0.0 would immediately respond 404, without attempting to match further routes. With this release, the behavior changes to matching additional routes until one returns a custom 404 response object, or all routes have been matched.

This behavior is more in line with how shelf_router version 0.7.x worked, and since many affected users consider the behavior from 1.0.0 a defect, we decided to remedy the situation.

1.0.0 #

  • Migrate package to null-safety
  • Since handlers are not allowed to return null in shelf 1.0.0, a router will return a default 404 response instead. This behavior can be overridden with the notFoundHandler constructor parameter.
  • Breaking: Remove deprecated Router.handler getter. The router itself is a handler.

0.7.4 #

  • Update Router.mount parameter to accept a Handler.
  • Make Router to be considered a Handler.
  • Deprecate the Router.handler getter.

0.7.3 #

  • Added @sealed annotation to Router and Route.

0.7.2 #

  • Always register a HEAD handler whenever a GET handler is registered. Defaulting to calling the GET handler and throwing away the body.

0.7.1 #

  • Use Function instead of dynamic in RouterEntry to improve typing.

0.7.0+1 #

  • Fixed description to fit size recommendations.

0.7.0 #

  • Initial release
324
likes
160
points
568k
downloads

Documentation

API reference

Publisher

verified publishertools.dart.dev

Weekly Downloads

A convenient request router for the shelf web-framework, with support for URL-parameters, nested routers and routers generated from source annotations.

Repository (GitHub)
View/report issues
Contributing

Topics

#server #shelf

License

Apache-2.0 (license)

Dependencies

http_methods, meta, shelf

More

Packages that depend on shelf_router