Complete, fast and testable actions for Rack
- [Tom de Bruijn, Tim Riley] When an action is called, add the action instance to the Rack environment under the
"hanami.action_instance"key (#446)
- [Tim Riley, Krzysztof Piotrowski] Add support for using full dry-validation contracts for action param validation, via
Hanami::Action.contract(#453, #454)
- Drop support for Ruby 3.0
- [Luca Guidi] Ensure Rack compatibility of
Hanami::Action::Response#send_file(#431)
- [Luca Guidi]
Hanami::Action::Config#root: don't check realpath existence to simplify the boot process of Hanami (#429)
- [Tim Riley] Add
Request#session_enabled?andResponse#session_enabled?(#423)
- [Adam Lassek] Params Pattern Matching
- [Adam Lassek, Luca Guidi] Allow to
haltusing aSymbol:halt :unauthorized - [Adam Lassek, Luca Guidi] Introduce
Hanami::Action::Response#status=to accept anIntegeror aSymbol
- [Pat Allan] Ensure action accepting the request with a custom MIME Type
- [Luca Guidi] Halting with an unknown HTTP code will raise a
Hanami::Action::UnknownHttpStatusError - [Luca Guidi] Fix error message for missing format (MIME Type)
- [Luca Guidi] Official support for Ruby 3.2
- [Tim Riley] Use Zeitwerk to autoload the gem
- [Tim Riley] Introduce
Hanami::Action::Config#formats. Useconfig.actions.formats.add(:json). Custom formats can useconfig.actions.formats.add(:graphql, ["application/graphql"])
- [Tim Riley] Changed
Hanami::Action::Config#formatsemantic: it's no longer used to add custom MIME Types, but as a macro to setup the wanted format for action(s) - [Tim Riley] Removed
Hanami::Action::Config#default_request_formatand#default_response_format, use#formatfor both - [Tim Riley] Removed
Hanami::Action::Config#accept, use#format
- [Tim Riley] Simplify assignment of response format:
response.format = :json(wasresponse.format = format(:json))
- [Tim Riley] Add
Response#flash, and delgate to request object for bothResponse#sessionandResponse#flash, ensuring the same objects are used when accessed via either request or response (#399)
- [Benjamin Klotz] When a params validation schema is provided (in a
params doblock), only return the validated params fromrequest.params(#375) - [Sean Collins] Handle dry-schema's messages hash now being frozen by default (#391)
- [Tim Riley] When
Action.acceptis declared (orAction::Config.accepted_formatsconfigured), return a 406 error if anAcceptrequest header is present but is not acceptable. In the absence of anAcceptheader, return a 415 error if aContent-Typeheader is present but not acceptable. If neither header is provided, accept the request. (#396) - [Tim Riley] Add
Action.handle_exceptionclass method as a shortcut forHanami::Action::Config#handle_exception(#394) - [Tim Riley] Significantly reduce memory usage by leveraging recent dry-configurable changes, and relocating
accepted_formats,before_callbacks,after_callbacksinheritable attributes toconfig(#392) - [Tim Riley] Make params validation schemas (defined in
params doblock) inheritable to subclasses (#394) - [Benhamin Klotz, Tim Riley] Raise
Hanami::Action::MissingSessionErrorwith a friendly message ifRequest#session,Request#flash,Response#sessionorResponse#flashare called for an action that does not already includeHanami::Action:Sessionmixin (#379 via #395)
- [Benjamin Klotz] Using
Hanami::Action.paramswithout havinghanami-validationsinstalled now returns a user-friendly error - [Narinda Reeders] Ensure HEAD responses to send empty body, but preserve headers
- [Narinda Reeders] Ensure HEAD redirect responses to return redirect headers
- [Andrew Croome] Do not automatically render halted requests
- [Tim Riley] Removed automatic integration of
Hanami::Actionsubclasses with their surrounding Hanami application. Action base classes within Hanami apps should inherit fromHanami::Application::Actioninstead.
- [Luca Guidi] Official support for Ruby: MRI 3.1
- [Luca Guidi] Drop support for Ruby: MRI 2.6, and 2.7.
- [Sean Collins] Align with Rack list of HTTP supported status. Added:
103,306,421,425,451, and509. Removed:418,420,444,449,450,451,499,598,599.
- [Philip Arndt] Added "rss" ("application/rss+xml") to list of supported MIME types
- [Luca Guidi] Manage Content Security Policy (CSP) defaults and new API via
Hanami::Action::ApplicationConfiguration#content_security_policy - [Tim Riley & Marc Busqué] Provide access to routes inside all application actions via
Hanami::Action::ApplicationAction#routes
- [Luca Guidi] Automatically include session behavior in
Hanami::Actionwhen sessions are enabled via Hanami application config - [Sean Collins] Pass exposures from action to view
- [Tim Riley] (Internal) Updated settings to use updated
settingAPI in dry-configurable 0.13.0 - [Sean Collins] Move automatic view rendering from
handletofinish
- [Luca Guidi] Official support for Ruby: MRI 3.0
- [Tim Riley] Introduced
Hanami::Action::ApplicationAction - [Tim Riley] Introduced
Hanami::Action::Configuration - [Tim Riley] Introduced
Hanami::Action::ApplicationConfiguration - [Tim Riley] Auto-inject a paired view into any
Hanami::Action::ApplicationActioninstance - [Tim Riley] Auto-render
Hanami::Action::ApplicationActionsubclasses that don't implement#handle - [Tim Riley] Enable CSRF protection automatically when HTTP sessions are enabled
- [Luca Guidi] Ensure
Hanami::Action::Response#renderable?to returnfalsewhen body is set - [Andrew Croome] Ensure
Hanami::Action.acceptto use RackCONTENT_TYPEfor the before callback check
- [Luca Guidi] Drop support for Ruby: MRI 2.5.
- [Tim Riley] Removed
Hanami::Action.handle_exceptionin favor ofHanami::Action.config.handle_exception - [Tim Riley] Rewritten
Hanami::Action::Flash, based on Roda'sFlashHash
- [Luca Guidi]
Hanami::Action::Request#sessionto access the HTTP session as it was originally sent - [Luca Guidi]
Hanami::Action::Request#cookiesto access the HTTP cookies as they were originally sent - [Luca Guidi & Tim Riley] Allow to build a deep inheritance chain for actions
- [Luca Guidi] Drop support for Ruby: MRI 2.3, and 2.4.
- [Luca Guidi]
Hanami::Actionis a superclass - [Luca Guidi]
Hanami::Action#initializerequires aconfiguration:keyword argument - [Luca Guidi]
Hanami::Action#initializereturns a frozen action instance - [Tim Riley]
Hanami::Actionsubclasses must implement#handleinstead of#call - [Luca Guidi]
Hanami::Action#handleacceptsHanami::Action::RequestandHanami::Action::Response - [Luca Guidi]
Hanami::Action#handlereturnsHanami::Action::Response - [Luca Guidi] Removed
Hanami::Controller.configure,.configuration,.duplicate, and.load! - [Luca Guidi] Removed
Hanami::Action.useto mount Rack middleware at the action level - [Luca Guidi]
Hanami::Controller::Configurationchanged syntax from DSL style to setters (eg.Hanami::Controller::Configuration.new { |c| c.default_request_format = :html }) - [Luca Guidi]
Hanami::Controller::Configuration#initializereturns a frozen configuration instance - [Luca Guidi] Removed
Hanami::Controller::Configuration#prepare - [Luca Guidi] Removed
Hanami::Action.configuration - [Luca Guidi] Removed
Hanami::Action.configuration.handle_exceptions - [Luca Guidi] Removed
Hanami::Action.configuration.default_request_formatin favor of#default_request_format - [Luca Guidi] Removed
Hanami::Action.configuration.default_charsetin favor of#default_charset - [Luca Guidi] Removed
Hanami::Action.configuration.formatto register a MIME Type for a single action. Please use the configuration. - [Luca Guidi] Removed
Hanami::Action.exposein favor ofHanami::Action::Response#[]=and#[] - [Luca Guidi] Removed
Hanami::Action#status=in favor ofHanami::Action::Response#status= - [Luca Guidi] Removed
Hanami::Action#body=in favor ofHanami::Action::Response#body= - [Luca Guidi] Removed
Hanami::Action#headersin favor ofHanami::Action::Response#headers - [Luca Guidi] Removed
Hanami::Action#accept?in favor ofHanami::Action::Request#accept? - [Luca Guidi] Removed
Hanami::Action#formatin favor ofHanami::Action::Response#format - [Luca Guidi] Introduced
Hanami::Action#formatas factory to assign response format:res.format = format(:json)orres.format = format("application/json") - [Luca Guidi] Removed
Hanami::Action#format=in favor ofHanami::Action::Response#format= - [Gustavo Caso]
Hanami::Action.acceptnow looks at requestContent-Typeheader to accept/deny a request - [Luca Guidi] Removed
Hanami::Action#request_idin favor ofHanami::Action::Request#id - [Gustavo Caso] Removed
Hanami::Action#parsed_request_bodyin favor ofHanami::Action::Request#parsed_body - [Luca Guidi] Removed
Hanami::Action#head?in favor ofHanami::Action::Request#head? - [Luca Guidi] Removed
Hanami::Action#statusin favor ofHanami::Action::Response#status=and#body= - [Luca Guidi] Removed
Hanami::Action#sessionin favor ofHanami::Action::Response#session - [Luca Guidi] Removed
Hanami::Action#cookiesin favor ofHanami::Action::Response#cookies - [Luca Guidi] Removed
Hanami::Action#flashin favor ofHanami::Action::Response#flash - [Luca Guidi] Removed
Hanami::Action#redirect_toin favor ofHanami::Action::Response#redirect_to - [Luca Guidi] Removed
Hanami::Action#cache_control,#expires, and#freshin favor ofHanami::Action::Response#cache_control,#expires, and#fresh, respectively - [Luca Guidi] Removed
Hanami::Action#send_fileand#unsafe_send_filein favor ofHanami::Action::Response#send_fileand#unsafe_send_file, respectively - [Luca Guidi] Removed
Hanami::Action#errors - [Gustavo Caso] Removed body cleanup for
HEADrequests - [Luca Guidi]
Hanami::Actioncallback hooks now acceptHanami::Action::RequestandHanami::Action::Responsearguments - [Luca Guidi] When an exception is raised, it won't be caught, unless it's handled
- [Luca Guidi]
Hanami::Actionexception handlers now acceptHanami::Action::Request,Hanami::Action::Response, and exception arguments
- [Luca Guidi] Official support for Ruby: MRI 2.7
- [Luca Guidi] Support
rack2.1 - [Luca Guidi] Support for both
hanami-validations1 and 2
- [Ian Ker-Seymer] Ensure
Etagto work whenIf-Modified-Sinceis sent from browser and upstream proxy setsLast-Modifiedautomatically.
- [Luca Guidi] Official support for Ruby: MRI 2.6
- [Luca Guidi] Support
bundler2.0+
- [Gustavo Caso] Swappable JSON backed for
Hanami::Action::Flashbased onHanami::Utils::Json
- [Luca Guidi] Official support for JRuby 9.2.0.0
- [Yuji Ueki] Ensure that if
If-None-MatchorIf-Modified-Sinceresponse HTTP headers are missing,EtagorLast-Modifiedheaders will be in response HTTP headers. - [Gustavo Caso] Don't show flash message for the request after a HTTP redirect.
- [Gustavo Caso] Ensure
Hanami::Action::Flash#each,#map, and#empty?to not reference stale flash data.
- [Gustavo Caso] Deprecate
Hanami::Action#parsed_request_body
- [Gustavo Caso] Introduce
Hanami::Action::Flash#eachand#map
- [Luca Guidi] Official support for Ruby: MRI 2.5
- [Sergey Fedorov] Introduce
Hanami::Action.content_typeto accept/reject requests according to theirContent-Typeheader.
- [wheresmyjetpack] Raise meaningful exception when trying to access
sessionorflashandHanami::Action::Sessionwasn't included.
- [Luca Guidi] Ensure
Hanami::Action#send_fileand#unsafe_send_fileto runafteraction callbacks - [Luca Guidi] Ensure Rack env to have the
REQUEST_METHODkey set toGETduring actions unit tests
- [Luca Guidi] Introduce
Hanami::Action::CookieJar#eachto iterate through action'scookies
- [Luca Guidi] Introduce
Hanami::Action::Params::Errors#addto add errors not generated by params validations
- [Marcello Rocha] Ensure validation params to be symbolized in all the environments
- [Marcello Rocha] Fix regression (
1.0.0) about MIME type priority, during the evaluation of a weightedAcceptHTTP header
- [Luca Guidi]
Action#flashis now public API
- [Marcello Rocha] Add
Action#unsafe_send_fileto send files outside of the public directory of a project
- [Anton Davydov] Ensure HTTP Cache to not crash when
HTTP_IF_MODIFIED_SINCEandHTTP_IF_NONE_MATCHhave blank values - [Luca Guidi] Keep flash values after a redirect
- [Craig M. Wellington & Luca Guidi] Ensure to return 404 when
Action#send_filecannot find a file with a globbed route - [Luca Guidi] Don't mutate Rack env when sending files
- [Luca Guidi] Official support for Ruby: MRI 2.4
- [Marcello Rocha & Luca Guidi] Avoid MIME type conflicts for
Action#formatdetection - [Matias H. Leidemer & Luca Guidi] Ensure
Flashto return only fresh data - [Luca Guidi] Ensure
sessionkeys to be accessed as symbols in action unit tests
- [Anton Davydov & Luca Guidi] Make it work only with Rack 2.0
- [Thorbjørn Hermansen] Don't pollute Rack env's
rack.exceptionkey if an exception is handled - [Luca Guidi] Add
flashto the default exposures
- [Marion Duprey] Allow
BaseParams#getto read (nested) arrays
- [Russell Cloak] Respect custom formats when referenced by HTTP
Accept - [Kyle Chong] Don't symbolize raw params
- [Luca Guidi] Let
BaseParams#getto accept a list of keys (symbols) instead of string with dot notation (params.get(:customer, :address, :city)instead ofparams.get('customer.address.city'))
- [Kyle Chong] Introduced
parsed_request_bodyfor action - [Luca Guidi] Introduced
Hanami::Action::BaseParams#each
- [Ayleen McCann] Use default content type when
HTTP_ACCEPTis*/* - [Kyle Chong] Don't stringify uploaded files
- [Kyle Chong] Don't stringify params values when not necessary
- [akhramov & Luca Guidi] Raise
Hanami::Controller::IllegalExposureErrorwhen try to expose reserved words:params, andflash.
- [Luca Guidi] Introduced
Hanami::Action::Params#error_messageswhich returns a flat collection of full error messages
- [Luca Guidi] Params are deeply symbolized
- [Artem Nistratov] Send only changed cookies in HTTP response
- [Luca Guidi] Drop support for Ruby 2.0 and 2.1. Official support for JRuby 9.0.5.0+.
- [Luca Guidi] Param validations now require you to add
hanami-validationsinGemfile. - [Luca Guidi] Removed "indifferent access" for params. Since now on, only symbols are allowed.
- [Luca Guidi] Params are immutable
- [Luca Guidi] Params validations syntax has changed
- [Luca Guidi]
Hanami::Action::Params#errorsnow returns a Hash. Keys are symbols representing invalid params, while values are arrays of strings with a message of the failure. - [Vasilis Spilka] Made
Hanami::Action::Session#errorspublic
- [Anatolii Didukh] Optimise memory usage by freezing MIME types constant
- [Luca Guidi] Renamed the project
- [Alfonso Uceda] Ensure
rack.sessioncookie to not be sent twice when bothLotus::Action::CookiesandRack::Session::Cookieare used together
- [Luca Guidi] Reference a raised exception in Rack env's
rack.exception. Compatibility with exception reporting SaaS.
- [Cainã Costa] Ensure Rack environment to be always available for sessions unit tests
- [Luca Guidi] Ensure superclass exceptions to not shadow subclasses during exception handling (eg.
CustomErrorhandler will take precedence overStandardError)
- [Luca Guidi] Removed
Lotus::Controller::Configuration#default_format - [Cainã Costa] Made
Lotus::Action#sessiona public method for improved unit testing - [Karim Tarek] Introduced
Lotus::Controller::Errorand let all the framework exceptions to inherit from it.
- [Luca Guidi] Allow to force custom headers for responses that according to RFC shouldn't include them (eg 204). Override
#keep_response_header?(header)in action
- [Theo Felippe] Added configuration entries:
#default_request_formatanddefault_response_format. - [Wellington Santos] Error handling to take account of inherited exceptions.
- [Theo Felippe] Deprecated
#default_formatin favor of:#default_request_format.
- [Luca Guidi] Security protection against Cross Site Request Forgery (CSRF).
- [Matthew Bellantoni] Ensure nested params to be correctly coerced to Hash.
- [Alfonso Uceda Pompa & Luca Guidi] Introduced
Lotus::Action#send_file - [Alfonso Uceda Pompa] Set automatically
Expiresoption for cookies when it's missing butMax-Ageis present. Compatibility with old browsers.
- [Luca Guidi] Ensure
Lotus::Action::Params#to_hto return::Hashat the top level
- [Luca Guidi] Ensure proper automatic
Content-Typeworking well with Internet Explorer. - [Luca Guidi] Ensure
Lotus::Action#redirect_toto return::Stringfor Rack servers compatibility.
- [Alfonso Uceda Pompa] Prevent
Content-TypeandContent-Lenghtto be sent when status code requires no body (eg.204). This is for compatibility withRack::Lint, not with RFC 2016. - [Luca Guidi] Ensure
Lotus::Action::Params#to_hto return::Hash
- [Erol Fornoles]
Action.usenow accepts a block - [Alfonso Uceda Pompa] Introduced
Lotus::Controller::Configuration#cookiesas default cookie options. - [Alfonso Uceda Pompa] Introduced
Lotus::Controller::Configuration#default_headersas default HTTP headers to return in all the responses. - [Luca Guidi] Introduced
Lotus::Action::Params#getas a safe API to access nested params.
- [Alfonso Uceda Pompa]
redirect_tonow is a flow control method: it terminates the execution of an action, including the callbacks.
- [Alfonso Uceda Pompa] Callbacks: introduced
append_before(alias ofbefore),append_after(alias ofafter),prepend_beforeandprepend_after. - [Alfonso Uceda Pompa] Introduced
Lotus::Action::Params#rawwhich returns unfiltered data as it comes from an HTTP request. - [Alfonso Uceda Pompa]
Lotus::Action::Rack.usenow fully supports Rack middleware, by mounting an internalRack::Builderinstance. - [Simone Carletti]
Lotus::Action::Throwable#haltnow accepts an optional message. If missing it falls back to the corresponding HTTP status message. - [Steve Hodgkiss] Nested params validation
- [Luca Guidi] Ensure HEAD requests will return empty body
- [Stefano Verna] Ensure HTTP status codes with empty body won't send body and non-entity headers.
- [Luca Guidi] Only dump exceptions in
rack.errorsif handling is turned off, or the raised exception is not managed. - [Luca Guidi] Ensure params will return coerced values
- [Lasse Skindstad Ebert] Introduced
Action#requestwhich returns an instance aRack::Requestcompliant object:Lotus::Action::Request.
- [Steve Hodgkiss] Ensure params to return coerced values
- [Luca Guidi] Introduced
Action#request_idas unique identifier for an incoming HTTP request - [Luca Guidi] Introduced
Lotus::Controller.load!as loading framework entry point - [Kir Shatrov] Allow to define a default charset (
default_charsetconfiguration) - [Kir Shatrov] Automatic content type with charset (eg
Content-Type: text/html; charset=utf-8) - [Michał Krzyżanowski] Allow to specify custom exception handlers: procs or methods (
exception_handlerconfiguration) - [Karl Freeman & Lucas Souza] Introduced HTTP caching (
Cache-Control,Last-Modified, ETAG, Conditional GET, expires) - [Satoshi Amemiya] Introduced
Action::Params#to_hand#to_hash - [Luca Guidi] Added
#paramsand#errorsas default exposures - [Luca Guidi] Introduced complete params validations
- [Luca Guidi & Matthew Bellantoni] Allow to whitelist params
- [Luca Guidi & Matthew Bellantoni] Allow to define custom classes for params via
Action.params - [Krzysztof Zalewski] Introduced
Action#formatas query method to introspect the requested mime type - [Luca Guidi] Official support for Ruby 2.2
- [Trung Lê] Renamed
Configuration#modulesto#prepare - [Luca Guidi] Update HTTP status codes to IETF RFC 7231
- [Luca Guidi] When
Lotus::Controlleris included, don't inject code - [Luca Guidi] Removed
Controller.actionas a DSL to define actions - [Krzysztof Zalewski] Removed
Action#content_typein favor of#format=which accepts a symbol (eg.:json) - [Fuad Saud] Reduce method visibility where possible (Ruby
privateandprotected)
- [Luca Guidi] Don't let exposures definition to override existing methods
- [Luca Guidi] Introduced
Controller.configureandController.duplicate - [Luca Guidi] Introduced
Action.use, that let to use a Rack middleware as a before callback – [Luca Guidi] Allow to define a default mime type when the request isAccept: */*(default_formatconfiguration) – [Luca Guidi] Allow to register custom mime types and associate them to a symbol (formatconfiguration) - [Luca Guidi] Introduced
Configuration#handle_exceptionsto associate exceptions to HTTP statuses - [Damir Zekic] Allow developers to toggle exception handling (
handle_exceptionsconfiguration) - [Luca Guidi] Introduced
Controller::Configuration - [Luca Guidi] Official support for Ruby 2.1
- [Luca Guidi]
Lotus::Action::Paramsdoesn't inherit fromLotus::Utils::Hashanymore - [Luca Guidi]
Lotus::Action::CookieJardoesn't inherit fromLotus::Utils::Hashanymore - [Luca Guidi] Make HTTP status messages compliant with IANA and Rack
- [Damir Zekic] Moved
#throwoverride logic into#halt, which keeps the same semantic
- [Krzysztof Zalewski] Reference exception in
rack.errors
- [Luca Guidi] Introduced
Action.acceptto whitelist accepted mime types - [Luca Guidi] Introduced
Action#accept?as a query method for the current request - [Luca Guidi] Allow to whitelist handled exceptions and associate them to an HTTP status
- [Luca Guidi] Automatic
Content-Type - [Luca Guidi] Use
throwas a control flow which understands HTTP status - [Luca Guidi] Introduced opt-in support for HTTP/Rack cookies
- [Luca Guidi] Introduced opt-in support for HTTP/Rack sessions
- [Luca Guidi] Introduced HTTP redirect API
- [Luca Guidi] Introduced callbacks for actions: before and after
- [Luca Guidi] Introduced exceptions handling with HTTP statuses
- [Luca Guidi] Introduced exposures
- [Luca Guidi] Introduced basic actions compatible with Rack
- [Luca Guidi] Official support for Ruby 2.0