Rack compatible HTTP router for Ruby
- [Damian C. Rossney, Kyle Plump] Scopes with a dynamic segment (e.g.
scope ":locale" do
) and containing aroot
route will no longer match the root route for requests with a trailing slash. This makes the behavior consistent with scopes using static strings. (#273)
- [Damian C. Rossney, Kyle Plump] Support paths with different variable names in same path location (#273)
- Drop support for Ruby 3.0
- [Pat Allan] Fix PATH_INFO and SCRIPT_NAME for Rack apps mounted at the root (keep the leading slash in PATH_INFO, and set SCRIPT_NAME to a blank string)
- [Pat Allan] Process glob routes and mounted apps together, so that the routes can be handled in the user-specified order (previously, a root-mounted app would handle routes even if matching globs were declared earlier)
- [Pat Allan] Pass keyword args through to middleware
- [Tim Riley] Accept
not_allowed_proc:
argument when initializingHanami::Router
. This allows customisation of thenot_allowed
behavior like fornot_found
(#259)
- [Luca Guidi] Official support for Ruby 3.2
- [Armin, Luca Guidi] Introduce
Hanami::Middleware::BodyParser::FormParser
to parse multipart file upload
- [Luca Guidi] Return HTTP response header
Allow
when returning405
HTTP status
- [Luca Guidi] Don't parse request body when Body Parser already parsed it
- [Luca Guidi] During routes inspection, ensure to print path prefixes for nested named routes
- [Benjamin Klotz]
Hanami::Middleware::BodyParser::Parser#parse
(abstract method) to raiseNoMethodError
instead ofNotImplementedError
- [Peter Solnica]
Hanami::Middleware::BodyParser
can be initialized with one or more formats and additional custom mime types per format (Hanami::Middleware::BodyParser.new(app, [:json, :xml])
orHanami::Middleware::BodyParser.new(app, [json: "application/json+scim"])
) (#230)
- [Luca Guidi] [Internal] Ensure
Hanami::Middleware::Error
class is available where it is needed [#225]
- [Marc Busqué] Introduced
Hanami::Router::Formatter::CSV
for CSV inspection of the routes
- [Marc Busqué] Routes inspection: Don't print empty line after the definition of a
get
route - [Marc Busqué] Routes inspection: Print
<controller>.<action>
instead of(proc)
- [Marc Busqué] Routes inspection: Print
(block)
instead ofNilClass
when inspecting a route block
- [Luca Guidi] Official support for MRI 3.1
- [Luca Guidi] Parse non-GET request body and make it available in Rack env under the
router.params
key. For JSON requests, please useHanami:::Middleware::JsonParser
- [Luca Guidi] Drop support for Ruby: MRI 2.6, and 2.7.
- [Luca Guidi] Introduced
Hanami::Router#to_inspect
which returns a string blob with all the routes formatted for human readability
- [Luca Guidi] Official support for MRI 3.0
- [Luca Guidi] Introduced
Hanami::Middleware::BodyParser::Parser
as superclass for body parsers - [Paweł Świątkowski] Added
not_found:
option toHanami::Router#initialize
to customize HTTP 404 status
- [Luca Guidi]
Hanami::Router#initialize
do not yield block if not given - [Luca Guidi] Ensure to not accidentally cache response headers for HTTP 404 and 405
- [Luca Guidi] Ensure scoped root to not be added as trailing slash
- [Luca Guidi] Block syntax. Routes definition accept a block which returning value is the body of the Rack response.
- [Luca Guidi] Added
resolver:
option toHanami::Router#initialize
to provide your own strategy to load endpoints.
- [Luca Guidi] Removed
Hanami::Router#resource
and#resources
. - [Luca Guidi] Removed loading of routes endpoints.
- [Luca Guidi] Removed
inflector:
fromHanami::Router#initialize
- [Luca Guidi] Removed
scheme:
,host:
,port:
fromHanami::Router#initialize
, usebase_url:
instead.
- [Luca Guidi] Introduce
Hanami::Router#scope
to support single routing tier for Hanami - [Semyon Pupkov] Added
inflector:
option forHanami::Router#initialize
based ondry-inflector
- [Luca Guidi] Drop support for Ruby: MRI 2.3, and 2.4.
- [Luca Guidi] Renamed
Hanami::Router#namespace
=>#prefix
- [Gustavo Caso] Remove body cleanup for
HEAD
requests - [Semyon Pupkov] Remove the ability to force SSL (
force_ssl:
option forHanami::Router#initialize
) - [Gustavo Caso] Remove router body parsers (
parsers:
option forHanami::Router#initialize
) - [Luca Guidi] Globbed path requires named capture (was
get "/files/*"
, now isget "/files/*names"
) - [Luca Guidi] Router is frozen after initialization
- [Luca Guidi] All the code base respects the frozen string pragma
- [Luca Guidi]
Hanami::Router#initialize
requiresconfiguration:
option if routes endpoints areHanami::Action
subclasses
- [Luca Guidi] Official support for Ruby: MRI 2.7
- [Luca Guidi] Support
rack
2.1
- [Luca Guidi] Official support for Ruby: MRI 2.6
- [Luca Guidi] Support
bundler
2.0+
- [Tim Riley] Skip attempting to parse unknown types in
Hanami::Middleware::BodyParser
- [Luca Guidi] Official support for JRuby 9.2.0.0
- [Gustavo Caso] Introduce
Hanami::Middleware::BodyParser
Rack middleware to parse payload of non-GET HTTP requests.
- [Alfonso Uceda] Deprecate
Hanami::Router.new(force_ssl: true)
. Use webserver (eg. Nginx), Rack middleware (eg.rack-ssl
), or another strategy to force HTTPS connection. - [Gustavo Caso] Deprecate
Hanami::Router.new(body_parsers: [:json])
. UseHanami::Middleware::BodyParser
instead.
- [Luca Guidi] Official support for Ruby: MRI 2.5
- [malin-as] Ensure
Hanami::Router
to properly respond tounlink
- [Sergey Fedorov] Allow Rack applications to be mounted inside a namespace. (
namespace "api" { mount V1::App, at: "/v1" }
)
- [Luca Guidi] Introduce new introspection methods (
#redirect?
and#redirection_path
) for recognized routes (seeHanami::Router#recognize
)
- [Luca Guidi] Ensure
Hanami::Router#redirect
to be compatible with#recognize
- [Valentyn Ostakh] Deep symbolize params from parsed body
- [Luca Guidi]
Hanami::Router#recognize
must return a non-routeable object when the endpoint cannot be resolved
- [Luca Guidi] Official support for Ruby: MRI 2.4
- [Jakub Pavlík] Added
:as
option for RESTful resources (eg.resources :psi, controller: 'dogs', as: 'dogs'
)
- [Pascal Betz] Make compatible with Rack 2.0 only
- [Luca Guidi] Ensure JSON body parser to not eval untrusted input
- [Kyle Chong] Referenced params from body parses in Rack env via
router.parsed_body
- [Luca Guidi & Lucas Hosseini] Ensure params from routes take precedence over params from body parsing
- [Luca Guidi] Ensure inspector to respect path prefix of mouted apps
- [Luca Guidi] Official support for Ruby: MRI 2.3+ and JRuby 9.1.5.0+
- [Sean Collins] Introduced
Hanami::Router#root
. Example:root to: 'home#index'
, equivalent toget '/', to: 'home#index', as: :root
. - [Nicola Racco] Allow to mount Rack applications at a specific host. Example:
mount Blog, host: 'blog'
, which will be hit forGET http://blog.example.com
- [Luca Guidi] Support
multi_json
gem as backend for JSON body parser. Ifmulti_json
is present in the gem bundle, it will be used, otherwise it will fallback to Ruby'sJSON
. - [Luca Guidi] Introduced
Hanami::Routing::RecognizedRoute#path
in order to allow a better introspection
- [Andrew De Ponte] Make routes inspection to work when non-Hanami apps are mounted
- [Andrew De Ponte] Ensure to set the right
SCRIPT_NAME
in Rack env for mounted Hanami apps - [Luca Guidi] Fix
NoMethodError
whenHanami::Router#recognize
is invoked with a Rack env or a route name or a path that can't be recognized
– [Luca Guidi] Drop support for Ruby 2.0 and 2.1. Official support for JRuby 9.0.5.0+
- [Anton Davydov] Fix double leading slash for Capybara's
current_path
- [Luca Guidi] Fix body parsers for non Hash requests
- [Luca Guidi] Renamed the project
- [Anton Davydov] Print stacked lines for routes inspection
- [Luca Guidi] Added
Lotus::Router#recognize
as a testing facility. Examplerouter.recognize('/') # => associated route
- [Luca Guidi] Added
Lotus::Router.define
in order to wrap routes definitions inconfig/routes.rb
whenLotus::Router
is used outside of Lotus projects - [David Strauß] Make
Lotus::Routing::Parsing::JsonParser
compatible withapplication/vnd.api+json
MIME Type - [Alfonso Uceda Pompa] Improved exception messages for
Lotus::Router#path
and#url
- [Alfonso Uceda Pompa] Ensure
Lotus::Router#path
and#url
to generate correct URL for mounted applications - [Vladislav Zarakovsky] Ensure Force SSL mode to respect Rack SPEC
- [Alfonso Uceda Pompa] A failure for body parsers raises a
Lotus::Routing::Parsing::BodyParsingError
exception - [Karim Tarek] Introduced
Lotus::Router::Error
and let all the framework exceptions to inherit from it.
- [Luca Guidi] Official support for JRuby 9k+
- [Alfonso Uceda Pompa] Ensure mounted applications to not repeat their prefix (eg
/admin/admin
) - [Thiago Felippe] Ensure router inspector properly prints routes with repeated entries (eg
/admin/dashboard/admin
)
- [Alfonso Uceda Pompa] Force SSL (eg
Lotus::Router.new(force_ssl: true
). - [Alfonso Uceda Pompa] Allow router to accept a
:prefix
option, in order to generate prefixed routes.
- [Alfonso Uceda Pompa] Nested RESTful resource(s)
- [Alfonso Uceda Pompa] RESTful resource(s) have a correct pluralization/singularization for variables and named routes (eg.
/books/:id
is now:book
instead of:books
)
- [Alfonso Uceda Pompa] Lotus::Action compat: invoke
.call
if defined, otherwise fall back to#call
.
- [Luca Guidi & Alfonso Uceda Pompa] Introduced routes inspector for CLI
- [Luca Guidi & Janko Marohnić] Introduced body parser for JSON
- [Luca Guidi] Introduced request body parsers: they parse body and turn into params.
- [Fred Wu] Introduced Router#define
- [Luca Guidi] Fix for member/collection actions in RESTful resource(s): allow to take actions with a leading slash.
- [Janko Marohnić] Fix for nested namespaces and RESTful resource(s) under namespace. They were generating wrong route names.
- [Luca Guidi] Made InvalidRouteException to inherit from StandardError so it can be catched from anonymous
rescue
clause - [Luca Guidi] Fix RESTful resource(s) to respect :only/:except options
- [Luca Guidi] Aligned naming conventions with Lotus::Controller: no more BooksController::Index. Use Books::Index instead.
- [Luca Guidi] Removed
:prefix
option for routes. Use#namespace
blocks instead. - [Janko Marohnić] Make 301 the default redirect status
- [Luca Guidi] Introduced Lotus::Router#mount
- [Luca Guidi] Let specify a pattern for Lotus::Routing::EndpointResolver
- [Luca Guidi] Make Lotus::Routing::Endpoint::EndpointNotFound to inherit from StandardError, instead of Exception. This make it compatible with Rack::ShowExceptions.
- [Luca Guidi] Official support for Ruby 2.1
- [Luca Guidi] Added support for OPTIONS HTTP verb
- [Luca Guidi] Added Lotus::Routing::EndpointNotFound when a lazy endpoint can't be found
- [Luca Guidi] Make action separator customizable via Lotus::Router options.
- [Luca Guidi] Catch http_router exceptions and re-raise them with names under Lotus::Routing. This helps to have a stable public API.
- [Luca Guidi] Lotus::Routing::Resource::CollectionAction use configurable controller and action name separator over the hardcoded value
- [Luca Guidi] Implemented Lotus::Routing::Namespace#resource
- [Luca Guidi] Lotus::Routing::EndpointResolver now accepts options to inject namespace and suffix
- [Luca Guidi] Allow resolver and route class to be injected via options
- [Luca Guidi] Return 404 for not found and 405 for unacceptable HTTP method
- [Luca Guidi] Allow non-finished Rack responses to be used
- [Luca Guidi] Implemented lazy loading for endpoints
- [Luca Guidi] Implemented Lotus::Router.new to take a block and define routes
- [Luca Guidi] Add support for resource
- [Luca Guidi] Support for resource's member and collection
- [Luca Guidi] Add support for namespaces
- [Luca Guidi] Added support for RESTful resources
- [Luca Guidi] Add support for POST, DELETE, PUT, PATCH, TRACE
- [Luca Guidi] Routes constraints
- [Luca Guidi] Named urls
- [Luca Guidi] Added support for Procs as endpoints
- [Luca Guidi] Implemented redirect
- [Luca Guidi] Basic routing