hanami-action 3.0.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +985 -0
  3. data/LICENSE +20 -0
  4. data/README.md +873 -0
  5. data/hanami-action.gemspec +39 -0
  6. data/lib/hanami/action/body_parser/json.rb +20 -0
  7. data/lib/hanami/action/body_parser/multipart_form.rb +22 -0
  8. data/lib/hanami/action/body_parser.rb +109 -0
  9. data/lib/hanami/action/cache/cache_control.rb +84 -0
  10. data/lib/hanami/action/cache/conditional_get.rb +101 -0
  11. data/lib/hanami/action/cache/directives.rb +126 -0
  12. data/lib/hanami/action/cache/expires.rb +84 -0
  13. data/lib/hanami/action/cache.rb +29 -0
  14. data/lib/hanami/action/config/formats.rb +256 -0
  15. data/lib/hanami/action/config.rb +172 -0
  16. data/lib/hanami/action/constants.rb +283 -0
  17. data/lib/hanami/action/cookie_jar.rb +214 -0
  18. data/lib/hanami/action/cookies.rb +27 -0
  19. data/lib/hanami/action/csrf_protection.rb +217 -0
  20. data/lib/hanami/action/errors.rb +109 -0
  21. data/lib/hanami/action/flash.rb +176 -0
  22. data/lib/hanami/action/halt.rb +18 -0
  23. data/lib/hanami/action/mime/request_mime_weight.rb +66 -0
  24. data/lib/hanami/action/mime.rb +438 -0
  25. data/lib/hanami/action/params.rb +342 -0
  26. data/lib/hanami/action/rack/file.rb +41 -0
  27. data/lib/hanami/action/rack_utils.rb +11 -0
  28. data/lib/hanami/action/request/session.rb +68 -0
  29. data/lib/hanami/action/request.rb +141 -0
  30. data/lib/hanami/action/response.rb +481 -0
  31. data/lib/hanami/action/session.rb +47 -0
  32. data/lib/hanami/action/validatable.rb +166 -0
  33. data/lib/hanami/action/version.rb +13 -0
  34. data/lib/hanami/action/view_name_inferrer.rb +56 -0
  35. data/lib/hanami/action.rb +672 -0
  36. data/lib/hanami/http/status.rb +149 -0
  37. data/lib/hanami-action.rb +3 -0
  38. metadata +153 -0
data/CHANGELOG.md ADDED
@@ -0,0 +1,985 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Break Versioning](https://www.taoensso.com/break-versioning).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - Parse request bodies based on formats config. (@timriley in #500, #503, #511, @cllns in #508)
13
+
14
+ Parsers for multipart form bodies and JSON are included by default. These require `formats.accept :html` and `formats.accept :json` respectively. When no formats are configured, multipart form bodies are parsed if found.
15
+
16
+ Custom parsers may be registered via e.g. `formats.register(:custom, "application/custom", parser: ->(body, env) { ... })` or directly via `formats.body_parsers["application/custom"] = parser`.
17
+
18
+ Parsed body keys are deeply symbolized. Non-hash bodies are wrapped in `{_: parsed_body}`.
19
+ - Full JRuby support. (@katafrakt in #498)
20
+
21
+ ### Changed
22
+
23
+ ### Deprecated
24
+
25
+ ### Removed
26
+
27
+ ### Fixed
28
+
29
+ ### Security
30
+
31
+ [Unreleased]: https://github.com/hanami/hanami-action/compare/v3.0.0.rc1...HEAD
32
+
33
+ ## [3.0.0.rc1] - 2026-06-16
34
+
35
+ ### Added
36
+
37
+ - Parse request bodies based on formats config. (@timriley in #500, #503, #511, @cllns in #508)
38
+
39
+ Parsers for multipart form bodies and JSON are included by default. These require `formats.accept :html` and `formats.accept :json` respectively. When no formats are configured, multipart form bodies are parsed if found.
40
+
41
+ Custom parsers may be registered via e.g. `formats.register(:custom, "application/custom", parser: ->(body, env) { ... })` or directly via `formats.body_parsers["application/custom"] = parser`.
42
+
43
+ Parsed body keys are deeply symbolized. Non-hash bodies are wrapped in `{_: parsed_body}`.
44
+ - Full JRuby support. (@katafrakt in #498)
45
+
46
+ ### Changed
47
+
48
+ - Renamed gem from hanami-controller to hanami-action. You should now `require "hanami-action"` or `require "hanami/action"`. (@timriley in #507, @cllns in df365b5)
49
+ - Check for the dry-validation gem (instead of hanami-validations, which is now retired) before loading `Action.params` and `Action.contract` support. (@timriley in #505)
50
+ - Cache the action's resolved configuration as a frozen `Data` snapshot (via dry-configurable's `#to_data`) at initialization, avoiding repeated config lookups on the request hot path for improved memory usage and speed. Required bumping `dry-configurable` to `~> 1.4`. (@cllns in #512)
51
+
52
+ **Possibly breaking:** the action's config is now finalized (frozen) when the action is initialized, so mutating it from instance code is no longer possible. This was only ever an undocumented side-effect of implementation, not a supported pattern.
53
+ - Cut per-request allocations on the `Hanami::Action#call` hot path, roughly halving allocations and increasing throughput ~1.5–2.5× per action invocation. A minimal action drops from 51 to 16 allocations (69% fewer, 2.45× faster); an action with formats negotiating an `Accept` header drops from 95 to 61 allocations (36% fewer, 1.55× faster). (@cllns in #514)
54
+ - Require Ruby 3.3 or newer.
55
+
56
+ ### Removed
57
+
58
+ - Removed deprecated format config methods: `Action.format`, `config.format`, `config.formats.add`, `config.formats.values`. (@timriley in #504)
59
+ - Removed `Hanami::Action::Params.params` and support for defining a contract by subclassing `Hanami::Action::Params`. If you are subclassing `Hanami::Action::Params`, take your params block and move it into a `Dry::Validation::Contract` subclass. Then pass this contract class to `Hanami::Action.params` or `Hanami::Action.contract`. (@timriley in #513)
60
+
61
+ ```ruby
62
+ # Before
63
+ # class SignupParams < Hanami::Action::Params
64
+ # params do
65
+ # required(:email).filled(:str?)
66
+ # end
67
+ # end
68
+
69
+ # After
70
+ class SignupContract < Dry::Validation::Contract
71
+ params do
72
+ required(:email).filled(:str?)
73
+ end
74
+ end
75
+
76
+ class Signup < Hanami::Action
77
+ params SignupParams
78
+ end
79
+ ```
80
+
81
+ [3.0.0.rc1]: https://github.com/hanami/hanami-action/compare/v2.3.2...v3.0.0.rc1
82
+
83
+ ## [2.3.2] - 2026-06-12
84
+
85
+ ### Fixed
86
+
87
+ - Allow the gem to be eager loadeded by Zeitwerk. (@timriley in #515)
88
+
89
+ [2.3.2]: https://github.com/hanami/hanami-action/compare/v2.3.1...v2.3.2
90
+
91
+ ## [2.3.1] - 2025-12-06
92
+
93
+ ### Fixed
94
+
95
+ - Allow `handle_exception` to receive multiple class names as strings. (@sidane in #495)
96
+
97
+ ```ruby
98
+ class MyAction < Hanami::Action
99
+ config.handle_exception(
100
+ "MyException" => 500,
101
+ "MyOtherException" => 501
102
+ )
103
+ end
104
+ ```
105
+
106
+ [2.3.1]: https://github.com/hanami/hanami-action/compare/v2.3.0...v2.3.1
107
+
108
+ ## [2.3.0] - 2025-11-12
109
+
110
+ ### Added
111
+
112
+ - Fetch CSRF tokens from `X-CSRF-Token` request header, in addition to body params. (@masterT in #422)
113
+
114
+ ### Changed
115
+
116
+ - Allow `config.handle_exception` to receive an exception class name as a string. (@mathewdbutton in #488)
117
+
118
+ This allows you to handle exceptions in your actions without having to require the Ruby files that define the exception constants, which is often awkward if those exceptions come from far-removed layers of your app.
119
+
120
+ ```ruby
121
+ class MyAction < Hanami::Action
122
+ config.handle_exception "ROM::TupleCountMismatchError" => 404
123
+ end
124
+ ```
125
+ - Allow both `:unprocessable_entity` and `:unprocessable_content` and to be used to refer to the 422 HTTP status code (Rack v3 dropped the former and replaced it with the latter). (@alassek in #490)
126
+
127
+ ```ruby
128
+ def handle(request, response)
129
+ # Or :unprocessable_content, both work, on all Rack versions
130
+ response.status = :unprocessable_entity
131
+ end
132
+ ```
133
+
134
+ [2.3.0]: https://github.com/hanami/hanami-action/compare/v2.3.0.beta2...v2.3.0
135
+
136
+ ## [2.3.0.beta2] - 2025-10-17
137
+
138
+ ### Added
139
+
140
+ - Make format config more flexible. (Tim Riley in #485)
141
+
142
+ **Use `config.formats.register` to register a new format and its media types.**
143
+
144
+ This replaces `config.formats.add`. Unlike `.add` it does _not_ set the format as being one of the accpeted formats at the same time.
145
+
146
+ This change makes it easier to `register` your custom formats in app config or a base action class, without inadvertently causing format restrictions in descendent action classes.
147
+
148
+ A simple registration looks like this:
149
+
150
+ ```ruby
151
+ config.formats.register(:json, "application/json")
152
+ ```
153
+
154
+ `.register` also allows you to register one or more media types for the distinct stages of request processing:
155
+
156
+ - If you want to accept requests based on different/additional media types in `Accept` request headers, provide them as `accept_types:`
157
+ - If you want to accept requests based on different/additional media types in `Content-Type` request headers, provide them as `content_types:`
158
+ - If you do not provide these options, then the _default_ media type (the required second argument, after the format name) is used for each of the above
159
+ - This default media type is also set as the default `Content-Type` _response_ header for requests that match the format
160
+
161
+ Together, these allow you to register a format like this:
162
+
163
+ ```ruby
164
+ config.formats.register(
165
+ :jsonapi,
166
+ "application/vnd.api+json",
167
+ accept_types: ["application/vnd.api+json", "application/json"],
168
+ content_types: ["application/vnd.api+json", "application/json"],
169
+ )
170
+ ```
171
+
172
+ **Use `config.formats.accept` to accept specific formats from an action.**
173
+
174
+ `formats.accept` replaces `Action.format` and `config.format`. You can access your accepted formats via `formats.accepted`, which replaces `config.formats.values`.
175
+
176
+ To accept a format:
177
+
178
+ ```ruby
179
+ config.formats.accept :html, :json
180
+ config.formats.accepted # => [:html, :json]
181
+
182
+ config.formats.accept :csv # it is additive
183
+ config.formats.accepted # => [:html, :json, :csv]
184
+ ```
185
+
186
+ The first format you give to `accept` will also become the _default format_ for responses from your action.
187
+
188
+ **Use config.formats.default=` to set an action's default format.**
189
+
190
+ This is a new capability. Assign an action's default format using `config.formats.default=`.
191
+
192
+ The default format is used to set the response `Content-Type` header when the request does not specify a format via `Accept`.
193
+
194
+ ```ruby
195
+ config.formats.accept :html, :json
196
+
197
+ # When no default is already set, the first accepted format becomes default
198
+ config.formats.default # => :html
199
+
200
+ # But you can now configure this directly
201
+ config.formats.default = :json
202
+ ```
203
+
204
+ ### Changed
205
+
206
+ - `Action.format`, `config.format`, `config.formats.add`, `config.formats.values`, and `config.formats.values=` are deprecated and will be removed in Hanami 2.4. (Tim Riley in #485)
207
+ - Drop support for Ruby 3.1. (Tim Riley in #485)
208
+
209
+ [2.3.0.beta2]: https://github.com/hanami/hanami-action/compare/v2.3.0.beta1...v2.3.0.beta2
210
+
211
+ ## [2.3.0.beta1] - 2025-10-03
212
+
213
+ ### Added
214
+
215
+ - Add `Request#subdomains`, returning an array of subdomains for the current host, and `Request#subdomain` returning a dot-delimited subdomain string for the current host. Add `config.default_tld_length` setting for configuring the TLD length for your app's expected domain. (Wout in #481)
216
+
217
+ ### Changed
218
+
219
+ - Support Rack 3 in addition to Rack 2. (Kyle Plump, Tim Riley in #460)
220
+ - `request.session` is now an instance of `Hanami::Action::Request::Session`, which wraps the session object and provides access to session values via symbol keys. This was previously handled via symbolizing and reassigning the entire session hash, which is not compatible with Rack 3. (Tim Riley in #477)
221
+
222
+ ### Fixed
223
+
224
+ - Avoid false negatives in format/content type matches by checking against the request's media type, which excludes content type parameters (e.g. "test/plain" instead of "text/plain;charset=utf-8"). (wuarmin in #471)
225
+
226
+ [2.3.0.beta1]: https://github.com/hanami/hanami-action/compare/v2.2.0...v2.3.0.beta1
227
+
228
+ ## [2.2.0] - 2024-11-05
229
+
230
+ ### Added
231
+
232
+ - When an action is called, add the action instance to the Rack environment under the `"hanami.action_instance"` key. (Tom de Bruijn, Tim Riley in #446)
233
+
234
+ [2.2.0]: https://github.com/hanami/hanami-action/compare/v2.2.0.rc1...v2.2.0
235
+
236
+ ## [2.2.0.rc1] - 2024-10-29
237
+
238
+ [2.2.0.rc1]: https://github.com/hanami/hanami-action/compare/v2.2.0.beta2...v2.2.0.rc1
239
+
240
+ ## [2.2.0.beta2] - 2024-09-25
241
+
242
+ ### Added
243
+
244
+ - Add support for using full dry-validation contracts for action param validation, via `Hanami::Action.contract`. (Tim Riley, Krzysztof Piotrowski in #453, #454)
245
+
246
+ [2.2.0.beta2]: https://github.com/hanami/hanami-action/compare/v2.2.0.beta1...v2.2.0.beta2
247
+
248
+ ## [2.2.0.beta1] - 2024-07-16
249
+
250
+ ### Changed
251
+
252
+ - Drop support for Ruby 3.0. (Tim Riley in #454)
253
+
254
+ [2.2.0.beta1]: https://github.com/hanami/hanami-action/compare/v2.1.0...v2.2.0.beta1
255
+
256
+ ## [2.1.0] - 2024-02-27
257
+
258
+ [2.1.0]: https://github.com/hanami/hanami-action/compare/v2.1.0.rc3...v2.1.0
259
+
260
+ ## [2.1.0.rc3] - 2024-02-16
261
+
262
+ [2.1.0.rc3]: https://github.com/hanami/hanami-action/compare/v2.1.0.rc2...v2.1.0.rc3
263
+
264
+ ## [2.1.0.rc2] - 2023-11-08
265
+
266
+ [2.1.0.rc2]: https://github.com/hanami/hanami-action/compare/v2.1.0.rc1...v2.1.0.rc2
267
+
268
+ ## [2.1.0.rc1] - 2023-11-01
269
+
270
+ ### Fixed
271
+
272
+ - Ensure Rack compatibility of `Hanami::Action::Response#send_file`. (Luca Guidi in #431)
273
+
274
+ [2.1.0.rc1]: https://github.com/hanami/hanami-action/compare/v2.1.0.beta2...v2.1.0.rc1
275
+
276
+ ## [2.1.0.beta2] - 2023-10-04
277
+
278
+ ### Fixed
279
+
280
+ - `Hanami::Action::Config#root`: don't check realpath existence to simplify the boot process of Hanami. (Luca Guidi in #429)
281
+
282
+ [2.1.0.beta2]: https://github.com/hanami/hanami-action/compare/v2.1.0.beta1...v2.1.0.beta2
283
+
284
+ ## [2.1.0.beta1] - 2023-06-29
285
+
286
+ ### Added
287
+
288
+ - Add `Request#session_enabled?` and `Response#session_enabled?`. (Tim Riley in #423)
289
+
290
+ [2.1.0.beta1]: https://github.com/hanami/hanami-action/compare/v2.0.2...v2.1.0.beta1
291
+
292
+ ## [2.0.2] - 2023-02-01
293
+
294
+ ### Added
295
+
296
+ - Params Pattern Matching. (Adam Lassek in #417)
297
+ - Allow to `halt` using a `Symbol`: `halt :unauthorized`. (Adam Lassek, Luca Guidi in #418)
298
+ - Introduce `Hanami::Action::Response#status=` to accept an `Integer` or a `Symbol`. (Adam Lassek, Luca Guidi in #418)
299
+
300
+ ### Fixed
301
+
302
+ - Ensure action accepting the request with a custom MIME Type. (Pat Allan in #409)
303
+ - Halting with an unknown HTTP code will raise a `Hanami::Action::UnknownHttpStatusError`. (Luca Guidi in #418)
304
+ - Fix error message for missing format (MIME Type). (Luca Guidi in #418)
305
+
306
+ [2.0.2]: https://github.com/hanami/hanami-action/compare/v2.0.1...v2.0.2
307
+
308
+ ## [2.0.1] - 2022-12-25
309
+
310
+ ### Added
311
+
312
+ - Official support for Ruby 3.2. (Luca Guidi in #408)
313
+
314
+ [2.0.1]: https://github.com/hanami/hanami-action/compare/v2.0.0...v2.0.1
315
+
316
+ ## [2.0.0] - 2022-11-22
317
+
318
+ ### Added
319
+
320
+ - Use Zeitwerk to autoload the gem. (Tim Riley in #401)
321
+ - Introduce `Hanami::Action::Config#formats`. Use `config.actions.formats.add(:json)`. Custom formats can use `config.actions.formats.add(:graphql, ["application/graphql"])`. (Tim Riley in #401)
322
+
323
+ ### Changed
324
+
325
+ - Changed `Hanami::Action::Config#format` semantic: it's no longer used to add custom MIME Types, but as a macro to setup the wanted format for action(s). (Tim Riley in #401)
326
+ - Removed `Hanami::Action::Config#default_request_format` and `#default_response_format`, use `#format` for both. (Tim Riley in #401)
327
+ - Removed `Hanami::Action::Config#accept`, use `#format`. (Tim Riley in #401)
328
+
329
+ [2.0.0]: https://github.com/hanami/hanami-action/compare/v2.0.0.rc1...v2.0.0
330
+
331
+ ## [2.0.0.rc1] - 2022-11-08
332
+
333
+ ### Changed
334
+
335
+ - Simplify assignment of response format: `response.format = :json` (was `response.format = format(:json)`). (Tim Riley in #400)
336
+
337
+ [2.0.0.rc1]: https://github.com/hanami/hanami-action/compare/v2.0.0.beta4...v2.0.0.rc1
338
+
339
+ ## [2.0.0.beta4] - 2022-10-24
340
+
341
+ ### Added
342
+
343
+ - Add `Response#flash`, and delgate to request object for both `Response#session` and `Response#flash`, ensuring the same objects are used when accessed via either request or response. (Tim Riley in #399)
344
+
345
+ ### Changed
346
+
347
+ - When `Action.accept` is declared (or `Action::Config.accepted_formats` configured), return a 406 error if an `Accept` request header is present but is not acceptable. In the absence of an `Accept` header, return a 415 error if a `Content-Type` header is present but not acceptable. If neither header is provided, accept the request. (Tim Riley in #396)
348
+ - Add `Action.handle_exception` class method as a shortcut for `Hanami::Action::Config#handle_exception`. (Tim Riley in #394)
349
+ - Significantly reduce memory usage by leveraging recent dry-configurable changes, and relocating `accepted_formats`, `before_callbacks`, `after_callbacks` inheritable attributes to `config`. (Tim Riley in #392)
350
+ - Make params validation schemas (defined in `params do` block) inheritable to subclasses. (Tim Riley in #394)
351
+ - Raise `Hanami::Action::MissingSessionError` with a friendly message if `Request#session`, `Request#flash`, `Response#session` or `Response#flash` are called for an action that does not already include `Hanami::Action:Session` mixin. (Benhamin Klotz, Tim Riley in #379, #395)
352
+
353
+ ### Fixed
354
+
355
+ - When a params validation schema is provided (in a `params do` block), only return the validated params from `request.params`. (Benjamin Klotz in #375)
356
+ - Handle dry-schema's messages hash now being frozen by default. (Sean Collins in #391)
357
+
358
+ [2.0.0.beta4]: https://github.com/hanami/hanami-action/compare/v2.0.0.beta1...v2.0.0.beta4
359
+
360
+ ## [2.0.0.beta1] - 2022-07-20
361
+
362
+ ### Fixed
363
+
364
+ - Using `Hanami::Action.params` without having `hanami-validations` installed now returns a user-friendly error. (Benjamin Klotz in #371)
365
+ - Ensure HEAD responses to send empty body, but preserve headers. (Narinda Reeders in #368)
366
+ - Ensure HEAD redirect responses to return redirect headers. (Narinda Reeders in #368)
367
+ - Do not automatically render halted requests. (Andrew Croome in #364)
368
+
369
+ [2.0.0.beta1]: https://github.com/hanami/hanami-action/compare/v2.0.0.alpha8...v2.0.0.beta1
370
+
371
+ ## [2.0.0.alpha8] - 2022-02-19
372
+
373
+ ### Changed
374
+
375
+ - Removed automatic integration of `Hanami::Action` subclasses with their surrounding Hanami application. Action base classes within Hanami apps should inherit from `Hanami::Application::Action` instead. (Tim Riley in #362)
376
+
377
+ [2.0.0.alpha8]: https://github.com/hanami/hanami-action/compare/v2.0.0.alpha6...v2.0.0.alpha8
378
+
379
+ ## [2.0.0.alpha6] - 2022-02-10
380
+
381
+ ### Added
382
+
383
+ - Official support for Ruby: MRI 3.1. (Luca Guidi in #359)
384
+
385
+ ### Changed
386
+
387
+ - Drop support for Ruby: MRI 2.6, and 2.7. (Luca Guidi in #359)
388
+ - Align with Rack list of HTTP supported status. Added: `103`, `306`, `421`, `425`, `451`, and `509`. Removed: `418`, `420`, `444`, `449`, `450`, `451`, `499`, `598`, `599`. (Sean Collins in #358)
389
+
390
+ [2.0.0.alpha6]: https://github.com/hanami/hanami-action/compare/v2.0.0.alpha5...v2.0.0.alpha6
391
+
392
+ ## [2.0.0.alpha5] - 2022-01-12
393
+
394
+ ### Added
395
+
396
+ - Added "rss" ("application/rss+xml") to list of supported MIME types. (Philip Arndt in #357)
397
+
398
+ [2.0.0.alpha5]: https://github.com/hanami/hanami-action/compare/v2.0.0.alpha4...v2.0.0.alpha5
399
+
400
+ ## [2.0.0.alpha4] - 2021-12-07
401
+
402
+ ### Added
403
+
404
+ - Manage Content Security Policy (CSP) defaults and new API via `Hanami::Action::ApplicationConfiguration#content_security_policy`. (Luca Guidi in #354)
405
+ - Provide access to routes inside all application actions via `Hanami::Action::ApplicationAction#routes`. (Tim Riley & Marc Busqué in #352)
406
+
407
+ [2.0.0.alpha4]: https://github.com/hanami/hanami-action/compare/v2.0.0.alpha3...v2.0.0.alpha4
408
+
409
+ ## [2.0.0.alpha3] - 2021-11-09
410
+
411
+ ### Added
412
+
413
+ - Automatically include session behavior in `Hanami::Action` when sessions are enabled via Hanami application config. (Luca Guidi in #347)
414
+ - Pass exposures from action to view. (Sean Collins in #348)
415
+
416
+ ### Changed
417
+
418
+ - (Internal) Updated settings to use updated `setting` API in dry-configurable 0.13.0. (Tim Riley in #346)
419
+ - Move automatic view rendering from `handle` to `finish`. (Sean Collins in #348)
420
+
421
+ [2.0.0.alpha3]: https://github.com/hanami/hanami-action/compare/v2.0.0.alpha2...v2.0.0.alpha3
422
+
423
+ ## [2.0.0.alpha2] - 2021-05-04
424
+
425
+ ### Added
426
+
427
+ - Official support for Ruby: MRI 3.0. (Luca Guidi in #325)
428
+ - Introduced `Hanami::Action::ApplicationAction`. (Tim Riley in #325)
429
+ - Introduced `Hanami::Action::Configuration`. (Tim Riley in #325)
430
+ - Introduced `Hanami::Action::ApplicationConfiguration`. (Tim Riley in #325)
431
+ - Auto-inject a paired view into any `Hanami::Action::ApplicationAction` instance. (Tim Riley in #325)
432
+ - Auto-render `Hanami::Action::ApplicationAction` subclasses that don't implement `#handle`. (Tim Riley in #325)
433
+ - Enable CSRF protection automatically when HTTP sessions are enabled. (Tim Riley in #325)
434
+
435
+ ### Changed
436
+
437
+ - Drop support for Ruby: MRI 2.5. (Luca Guidi in #325)
438
+ - Removed `Hanami::Action.handle_exception` in favor of `Hanami::Action.config.handle_exception`. (Tim Riley in #325)
439
+ - Rewritten `Hanami::Action::Flash`, based on Roda's `FlashHash`. (Tim Riley in #325)
440
+
441
+ ### Fixed
442
+
443
+ - Ensure `Hanami::Action::Response#renderable?` to return `false` when body is set. (Luca Guidi in #325)
444
+ - Ensure `Hanami::Action.accept` to use Rack `CONTENT_TYPE` for the _before callback_ check. (Andrew Croome in #325)
445
+
446
+ [2.0.0.alpha2]: https://github.com/hanami/hanami-action/compare/v2.0.0.alpha1...v2.0.0.alpha2
447
+
448
+ ## [2.0.0.alpha1] - 2019-01-30
449
+
450
+ ### Added
451
+
452
+ - `Hanami::Action::Request#session` to access the HTTP session as it was originally sent. (Luca Guidi in #281)
453
+ - `Hanami::Action::Request#cookies` to access the HTTP cookies as they were originally sent. (Luca Guidi in #281)
454
+ - Allow to build a deep inheritance chain for actions. (Luca Guidi & Tim Riley in #281)
455
+
456
+ ### Changed
457
+
458
+ - Drop support for Ruby: MRI 2.3, and 2.4. (Luca Guidi in #281)
459
+ - `Hanami::Action` is a superclass. (Luca Guidi in #281)
460
+ - `Hanami::Action#initialize` requires a `configuration:` keyword argument. (Luca Guidi in #281)
461
+ - `Hanami::Action#initialize` returns a frozen action instance. (Luca Guidi in #281)
462
+ - `Hanami::Action` subclasses must implement `#handle` instead of `#call`. (Tim Riley in #281)
463
+ - `Hanami::Action#handle` accepts `Hanami::Action::Request` and `Hanami::Action::Response`. (Luca Guidi in #281)
464
+ - `Hanami::Action#handle` returns `Hanami::Action::Response`. (Luca Guidi in #281)
465
+ - Removed `Hanami::Controller.configure`, `.configuration`, `.duplicate`, and `.load!`. (Luca Guidi in #281)
466
+ - Removed `Hanami::Action.use` to mount Rack middleware at the action level. (Luca Guidi in #281)
467
+ - `Hanami::Controller::Configuration` changed syntax from DSL style to setters (eg. `Hanami::Controller::Configuration.new { |c| c.default_request_format = :html }`). (Luca Guidi in #281)
468
+ - `Hanami::Controller::Configuration#initialize` returns a frozen configuration instance. (Luca Guidi in #281)
469
+ - Removed `Hanami::Controller::Configuration#prepare`. (Luca Guidi in #281)
470
+ - Removed `Hanami::Action.configuration`. (Luca Guidi in #281)
471
+ - Removed `Hanami::Action.configuration.handle_exceptions`. (Luca Guidi in #281)
472
+ - Removed `Hanami::Action.configuration.default_request_format` in favor of `#default_request_format`. (Luca Guidi in #281)
473
+ - Removed `Hanami::Action.configuration.default_charset` in favor of `#default_charset`. (Luca Guidi in #281)
474
+ - Removed `Hanami::Action.configuration.format` to register a MIME Type for a single action. Please use the configuration. (Luca Guidi in #281)
475
+ - Removed `Hanami::Action.expose` in favor of `Hanami::Action::Response#[]=` and `#[]`. (Luca Guidi in #281)
476
+ - Removed `Hanami::Action#status=` in favor of `Hanami::Action::Response#status=`. (Luca Guidi in #281)
477
+ - Removed `Hanami::Action#body=` in favor of `Hanami::Action::Response#body=`. (Luca Guidi in #281)
478
+ - Removed `Hanami::Action#headers` in favor of `Hanami::Action::Response#headers`. (Luca Guidi in #281)
479
+ - Removed `Hanami::Action#accept?` in favor of `Hanami::Action::Request#accept?`. (Luca Guidi in #281)
480
+ - Removed `Hanami::Action#format` in favor of `Hanami::Action::Response#format`. (Luca Guidi in #281)
481
+ - Introduced `Hanami::Action#format` as factory to assign response format: `res.format = format(:json)` or `res.format = format("application/json")`. (Luca Guidi in #281)
482
+ - Removed `Hanami::Action#format=` in favor of `Hanami::Action::Response#format=`. (Luca Guidi in #281)
483
+ - `Hanami::Action.accept` now looks at request `Content-Type` header to accept/deny a request. (Gustavo Caso in #281)
484
+ - Removed `Hanami::Action#request_id` in favor of `Hanami::Action::Request#id`. (Luca Guidi in #281)
485
+ - Removed `Hanami::Action#parsed_request_body` in favor of `Hanami::Action::Request#parsed_body`. (Gustavo Caso in #281)
486
+ - Removed `Hanami::Action#head?` in favor of `Hanami::Action::Request#head?`. (Luca Guidi in #281)
487
+ - Removed `Hanami::Action#status` in favor of `Hanami::Action::Response#status=` and `#body=`. (Luca Guidi in #281)
488
+ - Removed `Hanami::Action#session` in favor of `Hanami::Action::Response#session`. (Luca Guidi in #281)
489
+ - Removed `Hanami::Action#cookies` in favor of `Hanami::Action::Response#cookies`. (Luca Guidi in #281)
490
+ - Removed `Hanami::Action#flash` in favor of `Hanami::Action::Response#flash`. (Luca Guidi in #281)
491
+ - Removed `Hanami::Action#redirect_to` in favor of `Hanami::Action::Response#redirect_to`. (Luca Guidi in #281)
492
+ - Removed `Hanami::Action#cache_control`, `#expires`, and `#fresh` in favor of `Hanami::Action::Response#cache_control`, `#expires`, and `#fresh`, respectively. (Luca Guidi in #281)
493
+ - Removed `Hanami::Action#send_file` and `#unsafe_send_file` in favor of `Hanami::Action::Response#send_file` and `#unsafe_send_file`, respectively. (Luca Guidi in #281)
494
+ - Removed `Hanami::Action#errors`. (Luca Guidi in #281)
495
+ - Removed body cleanup for `HEAD` requests. (Gustavo Caso in #281)
496
+ - `Hanami::Action` callback hooks now accept `Hanami::Action::Request` and `Hanami::Action::Response` arguments. (Luca Guidi in #281)
497
+ - When an exception is raised, it won't be caught, unless it's handled. (Luca Guidi in #281)
498
+ - `Hanami::Action` exception handlers now accept `Hanami::Action::Request`, `Hanami::Action::Response`, and exception arguments. (Luca Guidi in #281)
499
+
500
+ [2.0.0.alpha1]: https://github.com/hanami/hanami-action/compare/v1.3.3...v2.0.0.alpha1
501
+
502
+ ## [1.3.3] - 2020-01-14
503
+
504
+ ### Added
505
+
506
+ - Official support for Ruby: MRI 2.7. (Luca Guidi in #323)
507
+ - Support `rack` 2.1. (Luca Guidi in #323)
508
+ - Support for both `hanami-validations` 1 and 2. (Luca Guidi in #323)
509
+
510
+ [1.3.3]: https://github.com/hanami/hanami-action/compare/v1.3.2...v1.3.3
511
+
512
+ ## [1.3.2] - 2019-06-28
513
+
514
+ ### Fixed
515
+
516
+ - Ensure `Etag` to work when `If-Modified-Since` is sent from browser and upstream proxy sets `Last-Modified` automatically. (Ian Ker-Seymer in #321)
517
+
518
+ [1.3.2]: https://github.com/hanami/hanami-action/compare/v1.3.1...v1.3.2
519
+
520
+ ## [1.3.1] - 2019-01-18
521
+
522
+ ### Added
523
+
524
+ - Official support for Ruby: MRI 2.6. (Luca Guidi in #317)
525
+ - Support `bundler` 2.0+. (Luca Guidi in #317)
526
+
527
+ [1.3.1]: https://github.com/hanami/hanami-action/compare/v1.3.0...v1.3.1
528
+
529
+ ## [1.3.0] - 2018-10-24
530
+
531
+ ### Added
532
+
533
+ - Swappable JSON backed for `Hanami::Action::Flash` based on `Hanami::Utils::Json`. (Gustavo Caso in #306)
534
+
535
+ [1.3.0]: https://github.com/hanami/hanami-action/compare/v1.3.0.beta1...v1.3.0
536
+
537
+ ## [1.3.0.beta1] - 2018-08-08
538
+
539
+ ### Added
540
+
541
+ - Official support for JRuby 9.2.0.0. (Luca Guidi in #303)
542
+
543
+ ### Changed
544
+
545
+ - Deprecate `Hanami::Action#parsed_request_body`. (Gustavo Caso in #302)
546
+
547
+ ### Fixed
548
+
549
+ - Ensure that if `If-None-Match` or `If-Modified-Since` response HTTP headers are missing, `Etag` or `Last-Modified` headers will be in response HTTP headers. (Yuji Ueki in #299)
550
+ - Don't show flash message for the request after a HTTP redirect. (Gustavo Caso in #301)
551
+ - Ensure `Hanami::Action::Flash#each`, `#map`, and `#empty?` to not reference stale flash data. (Gustavo Caso in #301)
552
+
553
+ [1.3.0.beta1]: https://github.com/hanami/hanami-action/compare/v1.2.0...v1.3.0.beta1
554
+
555
+ ## [1.2.0] - 2018-04-11
556
+
557
+ [1.2.0]: https://github.com/hanami/hanami-action/compare/v1.2.0.rc2...v1.2.0
558
+
559
+ ## [1.2.0.rc2] - 2018-04-06
560
+
561
+ ### Added
562
+
563
+ - Introduce `Hanami::Action::Flash#each` and `#map`. (Gustavo Caso in #294)
564
+
565
+ [1.2.0.rc2]: https://github.com/hanami/hanami-action/compare/v1.2.0.rc1...v1.2.0.rc2
566
+
567
+ ## [1.2.0.rc1] - 2018-03-30
568
+
569
+ [1.2.0.rc1]: https://github.com/hanami/hanami-action/compare/v1.2.0.beta2...v1.2.0.rc1
570
+
571
+ ## [1.2.0.beta2] - 2018-03-23
572
+
573
+ [1.2.0.beta2]: https://github.com/hanami/hanami-action/compare/v1.2.0.beta1...v1.2.0.beta2
574
+
575
+ ## [1.2.0.beta1] - 2018-02-28
576
+
577
+ ### Added
578
+
579
+ - Official support for Ruby: MRI 2.5. (Luca Guidi in #290)
580
+ - Introduce `Hanami::Action.content_type` to accept/reject requests according to their `Content-Type` header. (Sergey Fedorov in #207)
581
+
582
+ ### Fixed
583
+
584
+ - Raise meaningful exception when trying to access `session` or `flash` and `Hanami::Action::Session` wasn't included. (wheresmyjetpack in #207)
585
+
586
+ [1.2.0.beta1]: https://github.com/hanami/hanami-action/compare/v1.1.1...v1.2.0.beta1
587
+
588
+ ## [1.1.1] - 2017-11-22
589
+
590
+ ### Fixed
591
+
592
+ - Ensure `Hanami::Action#send_file` and `#unsafe_send_file` to run `after` action callbacks. (Luca Guidi in #282)
593
+ - Ensure Rack env to have the `REQUEST_METHOD` key set to `GET` during actions unit tests. (Luca Guidi in #282)
594
+
595
+ [1.1.1]: https://github.com/hanami/hanami-action/compare/v1.1.0...v1.1.1
596
+
597
+ ## [1.1.0] - 2017-10-25
598
+
599
+ ### Added
600
+
601
+ - Introduce `Hanami::Action::CookieJar#each` to iterate through action's `cookies`. (Luca Guidi in #279)
602
+
603
+ [1.1.0]: https://github.com/hanami/hanami-action/compare/v1.1.0.rc1...v1.1.0
604
+
605
+ ## [1.1.0.rc1] - 2017-10-16
606
+
607
+ [1.1.0.rc1]: https://github.com/hanami/hanami-action/compare/v1.1.0.beta3...v1.1.0.rc1
608
+
609
+ ## [1.1.0.beta3] - 2017-10-04
610
+
611
+ [1.1.0.beta3]: https://github.com/hanami/hanami-action/compare/v1.1.0.beta2...v1.1.0.beta3
612
+
613
+ ## [1.1.0.beta2] - 2017-10-03
614
+
615
+ ### Added
616
+
617
+ - Introduce `Hanami::Action::Params::Errors#add` to add errors not generated by params validations. (Luca Guidi in #276)
618
+
619
+ [1.1.0.beta2]: https://github.com/hanami/hanami-action/compare/v1.1.0.beta1...v1.1.0.beta2
620
+
621
+ ## [1.1.0.beta1] - 2017-08-11
622
+
623
+ [1.1.0.beta1]: https://github.com/hanami/hanami-action/compare/v1.0.1...v1.1.0.beta1
624
+
625
+ ## [1.0.1] - 2017-07-10
626
+
627
+ ### Fixed
628
+
629
+ - Ensure validation params to be symbolized in all the environments. (Marcello Rocha in #269)
630
+ - Fix regression (`1.0.0`) about MIME type priority, during the evaluation of a weighted `Accept` HTTP header. (Marcello Rocha in #269)
631
+
632
+ [1.0.1]: https://github.com/hanami/hanami-action/compare/v1.0.0...v1.0.1
633
+
634
+ ## [1.0.0] - 2017-04-06
635
+
636
+ [1.0.0]: https://github.com/hanami/hanami-action/compare/v1.0.0.rc1...v1.0.0
637
+
638
+ ## [1.0.0.rc1] - 2017-03-31
639
+
640
+ [1.0.0.rc1]: https://github.com/hanami/hanami-action/compare/v1.0.0.beta3...v1.0.0.rc1
641
+
642
+ ## [1.0.0.beta3] - 2017-03-17
643
+
644
+ ### Changed
645
+
646
+ - `Action#flash` is now public API. (Luca Guidi in #262)
647
+
648
+ [1.0.0.beta3]: https://github.com/hanami/hanami-action/compare/v1.0.0.beta2...v1.0.0.beta3
649
+
650
+ ## [1.0.0.beta2] - 2017-03-02
651
+
652
+ ### Added
653
+
654
+ - Add `Action#unsafe_send_file` to send files outside of the public directory of a project. (Marcello Rocha in #257)
655
+
656
+ ### Fixed
657
+
658
+ - Ensure HTTP Cache to not crash when `HTTP_IF_MODIFIED_SINCE` and `HTTP_IF_NONE_MATCH` have blank values. (Anton Davydov in #253)
659
+ - Keep flash values after a redirect. (Luca Guidi in #259)
660
+ - Ensure to return 404 when `Action#send_file` cannot find a file with a globbed route. (Craig M. Wellington & Luca Guidi in #260)
661
+ - Don't mutate Rack env when sending files. (Luca Guidi in #260)
662
+
663
+ [1.0.0.beta2]: https://github.com/hanami/hanami-action/compare/v1.0.0.beta1...v1.0.0.beta2
664
+
665
+ ## [1.0.0.beta1] - 2017-02-14
666
+
667
+ ### Added
668
+
669
+ - Official support for Ruby: MRI 2.4. (Luca Guidi in #236)
670
+
671
+ ### Changed
672
+
673
+ - Make it work only with Rack 2.0. (Anton Davydov & Luca Guidi in #239)
674
+
675
+ ### Fixed
676
+
677
+ - Avoid MIME type conflicts for `Action#format` detection. (Marcello Rocha & Luca Guidi in #255)
678
+ - Ensure `Flash` to return only fresh data. (Matias H. Leidemer & Luca Guidi in #jardakotesovec)
679
+ - Ensure `session` keys to be accessed as symbols in action unit tests. (Luca Guidi in #237)
680
+
681
+ [1.0.0.beta1]: https://github.com/hanami/hanami-action/compare/v0.8.1...v1.0.0.beta1
682
+
683
+ ## [0.8.1] - 2016-12-19
684
+
685
+ ### Added
686
+
687
+ - Add `flash` to the default exposures. (Luca Guidi in #233)
688
+
689
+ ### Fixed
690
+
691
+ - Don't pollute Rack env's `rack.exception` key if an exception is handled. (Thorbjørn Hermansen in #234)
692
+
693
+ [0.8.1]: https://github.com/hanami/hanami-action/compare/v0.8.0...v0.8.1
694
+
695
+ ## [0.8.0] - 2016-11-15
696
+
697
+ ### Added
698
+
699
+ - Allow `BaseParams#get` to read (nested) arrays. (Marion Duprey in #227)
700
+
701
+ ### Changed
702
+
703
+ - Let `BaseParams#get` to accept a list of keys (symbols) instead of string with dot notation (`params.get(:customer, :address, :city)` instead of `params.get('customer.address.city')`). (Luca Guidi in #229)
704
+
705
+ ### Fixed
706
+
707
+ - Respect custom formats when referenced by HTTP `Accept`. (Russell Cloak in #221)
708
+ - Don't symbolize raw params. (Kyle Chong in #224)
709
+
710
+ [0.8.0]: https://github.com/hanami/hanami-action/compare/v0.7.1...v0.8.0
711
+
712
+ ## [0.7.1] - 2016-10-06
713
+
714
+ ### Added
715
+
716
+ - Introduced `parsed_request_body` for action. (Kyle Chong in #155)
717
+ - Introduced `Hanami::Action::BaseParams#each`. (Luca Guidi in #176)
718
+
719
+ ### Changed
720
+
721
+ - Raise `Hanami::Controller::IllegalExposureError` when try to expose reserved words: `params`, and `flash`. (akhramov & Luca Guidi in #195)
722
+
723
+ ### Fixed
724
+
725
+ - Use default content type when `HTTP_ACCEPT` is `*/*`. (Ayleen McCann in #211)
726
+ - Don't stringify uploaded files. (Kyle Chong in #213)
727
+ - Don't stringify params values when not necessary. (Kyle Chong in #214)
728
+
729
+ [0.7.1]: https://github.com/hanami/hanami-action/compare/v0.7.0...v0.7.1
730
+
731
+ ## [0.7.0] - 2016-07-22
732
+
733
+ ### Added
734
+
735
+ - Introduced `Hanami::Action::Params#error_messages` which returns a flat collection of full error messages. (Luca Guidi in #165)
736
+ - Nested params validation. (Steve Hodgkiss in #168)
737
+
738
+ ### Changed
739
+
740
+ - Drop support for Ruby 2.0 and 2.1. Official support for JRuby 9.0.5.0+. (Luca Guidi in #verbman)
741
+ - Param validations now require you to add `hanami-validations` in `Gemfile`. (Luca Guidi in #verbman)
742
+ - Removed "_indifferent access_" for params. Since now on, only symbols are allowed. (Luca Guidi in #verbman)
743
+ - Params are immutable. (Luca Guidi in #verbman)
744
+ - Params validations syntax has changed. (Luca Guidi in #verbman)
745
+ - `Hanami::Action::Params#errors` now returns a Hash. Keys are symbols representing invalid params, while values are arrays of strings with a message of the failure. (Luca Guidi in #verbman)
746
+ - Made `Hanami::Action::Session#errors` public. (Vasilis Spilka in #171)
747
+
748
+ ### Fixed
749
+
750
+ - Params are deeply symbolized. (Luca Guidi in #verbman)
751
+ - Send only changed cookies in HTTP response. (Artem Nistratov in #153)
752
+
753
+ [0.7.0]: https://github.com/hanami/hanami-action/compare/v0.6.1...v0.7.0
754
+
755
+ ## [0.6.1] - 2016-02-05
756
+
757
+ ### Changed
758
+
759
+ - Optimise memory usage by freezing MIME types constant. (Anatolii Didukh in #152)
760
+
761
+ [0.6.1]: https://github.com/hanami/hanami-action/compare/v0.6.0...v0.6.1
762
+
763
+ ## [0.6.0] - 2016-01-22
764
+
765
+ ### Changed
766
+
767
+ - Renamed the project. (Luca Guidi)
768
+
769
+ [0.6.0]: https://github.com/hanami/hanami-action/compare/v0.5.1...v0.6.0
770
+
771
+ ## [0.5.1] - 2016-01-19
772
+
773
+ ### Fixed
774
+
775
+ - Ensure `rack.session` cookie to not be sent twice when both `Lotus::Action::Cookies` and `Rack::Session::Cookie` are used together. (Alfonso Uceda in #148)
776
+
777
+ [0.5.1]: https://github.com/hanami/hanami-action/compare/v0.5.0...v0.5.1
778
+
779
+ ## [0.5.0] - 2016-01-12
780
+
781
+ ### Added
782
+
783
+ - Reference a raised exception in Rack env's `rack.exception`. Compatibility with exception reporting SaaS. (Luca Guidi in #129)
784
+
785
+ ### Changed
786
+
787
+ - Removed `Lotus::Controller::Configuration#default_format`. (Luca Guidi)
788
+ - Made `Lotus::Action#session` a public method for improved unit testing. (Cainã Costa in #135)
789
+ - Introduced `Lotus::Controller::Error` and let all the framework exceptions to inherit from it. (Karim Tarek in #147)
790
+
791
+ ### Fixed
792
+
793
+ - Ensure superclass exceptions to not shadow subclasses during exception handling (eg. `CustomError` handler will take precedence over `StandardError`). (Luca Guidi)
794
+ - Ensure Rack environment to be always available for sessions unit tests. (Cainã Costa in #135)
795
+
796
+ [0.5.0]: https://github.com/hanami/hanami-action/compare/v0.4.6...v0.5.0
797
+
798
+ ## [0.4.6] - 2015-12-04
799
+
800
+ ### Added
801
+
802
+ - Allow to force custom headers for responses that according to RFC shouldn't include them (eg 204). Override `#keep_response_header?(header)` in action. (Luca Guidi in #124)
803
+
804
+ [0.4.6]: https://github.com/hanami/hanami-action/compare/v0.4.5...v0.4.6
805
+
806
+ ## [0.4.5] - 2015-09-30
807
+
808
+ ### Added
809
+
810
+ - Added configuration entries: `#default_request_format` and `default_response_format`. (Theo Felippe in #122)
811
+ - Error handling to take account of inherited exceptions. (Wellington Santos in #127)
812
+
813
+ ### Deprecated
814
+
815
+ - Deprecate `#default_format` in favor of: `#default_request_format`. (Theo Felippe in #122)
816
+
817
+ [0.4.5]: https://github.com/hanami/hanami-action/compare/v0.4.4...v0.4.5
818
+
819
+ ## [0.4.4] - 2015-06-23
820
+
821
+ ### Added
822
+
823
+ - Security protection against Cross Site Request Forgery (CSRF). (Luca Guidi in #118)
824
+
825
+ ### Fixed
826
+
827
+ - Ensure nested params to be correctly coerced to Hash. (Matthew Bellantoni in #107)
828
+
829
+ [0.4.4]: https://github.com/hanami/hanami-action/compare/v0.4.3...v0.4.4
830
+
831
+ ## [0.4.3] - 2015-05-22
832
+
833
+ ### Added
834
+
835
+ - Introduced `Lotus::Action#send_file`. (Alfonso Uceda Pompa in #105)
836
+ - Set automatically `Expires` option for cookies when it's missing but `Max-Age` is present. Compatibility with old browsers. (Alfonso Uceda Pompa in #102)
837
+
838
+ [0.4.3]: https://github.com/hanami/hanami-action/compare/v0.4.2...v0.4.3
839
+
840
+ ## [0.4.2] - 2015-05-15
841
+
842
+ ### Fixed
843
+
844
+ - Ensure `Lotus::Action::Params#to_h` to return `::Hash` at the top level. (Luca Guidi in #101)
845
+
846
+ [0.4.2]: https://github.com/hanami/hanami-action/compare/v0.4.1...v0.4.2
847
+
848
+ ## [0.4.1] - 2015-05-15
849
+
850
+ ### Changed
851
+
852
+ - Prevent `Content-Type` and `Content-Lenght` to be sent when status code requires no body (eg. `204`). This is for compatibility with `Rack::Lint`, not with RFC 2016. (Alfonso Uceda Pompa in #99)
853
+ - Ensure `Lotus::Action::Params#to_h` to return `::Hash`. (Luca Guidi in #96)
854
+
855
+ ### Fixed
856
+
857
+ - Ensure proper automatic `Content-Type` working well with Internet Explorer. (Luca Guidi in #94)
858
+ - Ensure `Lotus::Action#redirect_to` to return `::String` for Rack servers compatibility. (Luca Guidi in #95)
859
+
860
+ [0.4.1]: https://github.com/hanami/hanami-action/compare/v0.4.0...v0.4.1
861
+
862
+ ## [0.4.0] - 2015-03-23
863
+
864
+ ### Added
865
+
866
+ - `Action.use` now accepts a block. (Erol Fornoles in #70)
867
+ - Introduced `Lotus::Controller::Configuration#cookies` as default cookie options. (Alfonso Uceda Pompa in #77)
868
+ - Introduced `Lotus::Controller::Configuration#default_headers` as default HTTP headers to return in all the responses. (Alfonso Uceda Pompa in #82)
869
+ - Introduced `Lotus::Action::Params#get` as a safe API to access nested params. (Luca Guidi in #89)
870
+
871
+ ### Changed
872
+
873
+ - `redirect_to` now is a flow control method: it terminates the execution of an action, including the callbacks. (Alfonso Uceda Pompa in #73)
874
+
875
+ [0.4.0]: https://github.com/hanami/hanami-action/compare/v0.3.2...v0.4.0
876
+
877
+ ## [0.3.2] - 2015-01-30
878
+
879
+ ### Added
880
+
881
+ - Callbacks: introduced `append_before` (alias of `before`), `append_after` (alias of `after`), `prepend_before` and `prepend_after`. (Alfonso Uceda Pompa in #65)
882
+ - Introduced `Lotus::Action::Params#raw` which returns unfiltered data as it comes from an HTTP request. (Alfonso Uceda Pompa in #69)
883
+ - `Lotus::Action::Rack.use` now fully supports Rack middleware, by mounting an internal `Rack::Builder` instance. (Alfonso Uceda Pompa in #66)
884
+ - Introduced `Lotus::Action::Throwable#halt` now accepts an optional message. If missing it falls back to the corresponding HTTP status message. (Simone Carletti in #67)
885
+ - Nested params validation. (Steve Hodgkiss in #50)
886
+
887
+ ### Fixed
888
+
889
+ - Ensure HEAD requests will return empty body. (Luca Guidi in #57)
890
+ - Ensure HTTP status codes with empty body won't send body and non-entity headers. (Stefano Verna in #18)
891
+ - Only dump exceptions in `rack.errors` if handling is turned off, or the raised exception is not managed. (Luca Guidi in #58)
892
+ - Ensure params will return coerced values. (Luca Guidi in #58)
893
+
894
+ [0.3.2]: https://github.com/hanami/hanami-action/compare/v0.3.1...v0.3.2
895
+
896
+ ## [0.3.1] - 2015-01-08
897
+
898
+ ### Added
899
+
900
+ - Introduced `Action#request` which returns an instance a `Rack::Request` compliant object: `Lotus::Action::Request`. (Lasse Skindstad Ebert in #48)
901
+
902
+ ### Fixed
903
+
904
+ - Ensure params to return coerced values. (Steve Hodgkiss in #54)
905
+
906
+ [0.3.1]: https://github.com/hanami/hanami-action/compare/v0.3.0...v0.3.1
907
+
908
+ ## [0.3.0] - 2014-12-23
909
+
910
+ ### Added
911
+
912
+ - Introduced `Action#request_id` as unique identifier for an incoming HTTP request. (Luca Guidi)
913
+ - Introduced `Lotus::Controller.load!` as loading framework entry point. (Luca Guidi)
914
+ - Allow to define a default charset (`default_charset` configuration). (Kir Shatrov in #45)
915
+ - Automatic content type with charset (eg `Content-Type: text/html; charset=utf-8`). (Kir Shatrov in #45)
916
+ - Allow to specify custom exception handlers: procs or methods (`exception_handler` configuration). (Michał Krzyżanowski in #44)
917
+ - Introduced HTTP caching (`Cache-Control`, `Last-Modified`, ETAG, Conditional GET, expires). (Karl Freeman & Lucas Souza in #43)
918
+ - Introduced `Action::Params#to_h` and `#to_hash`. (Satoshi Amemiya in #42)
919
+ - Added `#params` and `#errors` as default exposures. (Luca Guidi)
920
+ - Introduced complete params validations. (Luca Guidi)
921
+ - Allow to whitelist params. (Luca Guidi & Matthew Bellantoni in #38)
922
+ - Allow to define custom classes for params via `Action.params`. (Luca Guidi & Matthew Bellantoni in #38)
923
+ - Introduced `Action#format` as query method to introspect the requested mime type. (Krzysztof Zalewski in #37)
924
+ - Official support for Ruby 2.2. (Luca Guidi)
925
+
926
+ ### Changed
927
+
928
+ - Renamed `Configuration#modules` to `#prepare`. (Trung Lê in #41)
929
+ - Update HTTP status codes to IETF RFC 7231. (Luca Guidi)
930
+ - When `Lotus::Controller` is included, don't inject code. (Luca Guidi)
931
+ - Removed `Controller.action` as a DSL to define actions. (Luca Guidi)
932
+ - Removed `Action#content_type` in favor of `#format=` which accepts a symbol (eg. `:json`). (Krzysztof Zalewski in #37)
933
+ - Reduce method visibility where possible (Ruby `private` and `protected`). (Fuad Saud in #17)
934
+
935
+ ### Fixed
936
+
937
+ - Don't let exposures definition to override existing methods. (Luca Guidi in #40)
938
+
939
+ [0.3.0]: https://github.com/hanami/hanami-action/compare/v0.2.0...v0.3.0
940
+
941
+ ## [0.2.0] - 2014-06-23
942
+
943
+ ### Added
944
+
945
+ - Introduced `Controller.configure` and `Controller.duplicate`. (Luca Guidi)
946
+ - Introduced `Action.use`, that let to use a Rack middleware as a before callback. (Luca Guidi)
947
+ - Allow to define a default mime type when the request is `Accept: */*` (`default_format` configuration). (Luca Guidi)
948
+ - Allow to register custom mime types and associate them to a symbol (`format` configuration). (Luca Guidi)
949
+ - Introduced `Configuration#handle_exceptions` to associate exceptions to HTTP statuses. (Luca Guidi)
950
+ - Allow developers to toggle exception handling (`handle_exceptions` configuration). (Damir Zekic in #23)
951
+ - Introduced `Controller::Configuration`. (Luca Guidi)
952
+ - Official support for Ruby 2.1. (Luca Guidi)
953
+
954
+ ### Changed
955
+
956
+ - `Lotus::Action::Params` doesn't inherit from `Lotus::Utils::Hash` anymore. (Luca Guidi)
957
+ - `Lotus::Action::CookieJar` doesn't inherit from `Lotus::Utils::Hash` anymore. (Luca Guidi)
958
+ - Make HTTP status messages compliant with IANA and Rack. (Luca Guidi)
959
+ - Moved `#throw` override logic into `#halt`, which keeps the same semantic. (Damir Zekic in #28)
960
+
961
+ ### Fixed
962
+
963
+ - Reference exception in `rack.errors`. (Krzysztof Zalewski in #26)
964
+
965
+ [0.2.0]: https://github.com/hanami/hanami-action/compare/v0.1.0...v0.2.0
966
+
967
+ ## [0.1.0] - 2014-02-23
968
+
969
+ ### Added
970
+
971
+ - Introduced `Action.accept` to whitelist accepted mime types. (Luca Guidi)
972
+ - Introduced `Action#accept?` as a query method for the current request. (Luca Guidi)
973
+ - Allow to whitelist handled exceptions and associate them to an HTTP status. (Luca Guidi)
974
+ - Automatic `Content-Type`. (Luca Guidi)
975
+ - Use `throw` as a control flow which understands HTTP status. (Luca Guidi)
976
+ - Introduced opt-in support for HTTP/Rack cookies. (Luca Guidi)
977
+ - Introduced opt-in support for HTTP/Rack sessions. (Luca Guidi)
978
+ - Introduced HTTP redirect API. (Luca Guidi)
979
+ - Introduced callbacks for actions: before and after. (Luca Guidi)
980
+ - Introduced exceptions handling with HTTP statuses. (Luca Guidi)
981
+ - Introduced exposures. (Luca Guidi)
982
+ - Introduced basic actions compatible with Rack. (Luca Guidi)
983
+ - Official support for Ruby 2.0. (Luca Guidi)
984
+
985
+ [0.1.0]: https://github.com/hanami/hanami-action/releases/tag/v0.1.0