hanami-controller 2.1.0.beta2 → 2.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fc2d8c6c6c5d8427e000d3a9644ca79ebb06528052d9d85796aad26f12c00dd
4
- data.tar.gz: 689ba6ba0655450344f3e87f9a7723760a4673df0b3beb6e7b21fca8a18f7fcd
3
+ metadata.gz: a9d4981a4c7901ff4be64ae0a339886817da04a071e7490f440f745d971e4212
4
+ data.tar.gz: ffc574ca14b030a7e23b2b035f3df04f83c4b20aaca203c76dea61971cbb86e2
5
5
  SHA512:
6
- metadata.gz: 1e8bf47095abf0da69058e26e0d627cbb664c9b861a35de3b84173836f8cb76773bdf78ff233aedf8e09819de8f4ca5cc53f5116f73dd7d63fb54b1ae9c90656
7
- data.tar.gz: b09e1c0506ef1e309e6c53bc37ad503dd8821b159d4a60bd1142be3b105cb24ff67abd57871005eddc807451712dbf507e24c95e0c2ff0f38b8e53d9160329b8
6
+ metadata.gz: 9a579c0418d491bf872afddd9143043702d0f6f96b7b3bc47f5f56c6600f74da9da0cb8370b6cd103ad0c616285e2035b4cddd7cb94c0fcc0e78e4b7ae61311d
7
+ data.tar.gz: e4acfb84cd8610a9b81139e12730880484a5e6a7ec96fe518942256579bcaa6cd6fffe62221032633e26574e46d9bfaa38c1bd1fd46bec7e672e44d9490b4cdd
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  Complete, fast and testable actions for Rack
4
4
 
5
+ ## v2.1.0.rc2 - 2023-11-08
6
+
7
+ ## v2.1.0.rc1 - 2023-11-01
8
+
9
+ ### Fixed
10
+
11
+ - [Luca Guidi] Ensure Rack compatibility of `Hanami::Action::Response#send_file` (#431)
12
+
5
13
  ## v2.1.0.beta2 - 2023-10-04
6
14
 
7
15
  ### Fixed
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.required_ruby_version = ">= 3.0"
22
22
 
23
23
  spec.add_dependency "rack", "~> 2.0"
24
- spec.add_dependency "hanami-utils", "~> 2.0"
24
+ spec.add_dependency "hanami-utils", "~> 2.1.rc"
25
25
  spec.add_dependency "dry-configurable", "~> 1.0", "< 2"
26
26
  spec.add_dependency "dry-core", "~> 1.0"
27
27
  spec.add_dependency "zeitwerk", "~> 2.6"
@@ -73,15 +73,14 @@ module Hanami
73
73
  @length = 0
74
74
  @body = EMPTY_BODY.dup
75
75
 
76
- # FIXME: there could be a bug that prevents Content-Length to be sent for files
77
- if str.is_a?(::Rack::File::Iterator)
76
+ if str.is_a?(::Rack::Files::BaseIterator)
78
77
  @body = str
79
78
  else
80
79
  write(str) unless str.nil? || str == EMPTY_BODY
81
80
  end
82
81
  end
83
82
 
84
- # Set the response status
83
+ # Sets the response status.
85
84
  #
86
85
  # @param code [Integer, Symbol] the status code
87
86
  #
@@ -102,11 +101,21 @@ module Hanami
102
101
  super(Http::Status.lookup(code))
103
102
  end
104
103
 
105
- # This is NOT RELEASED with 2.0.0
104
+ # Sets the response body from the rendered view.
106
105
  #
107
- # @api private
108
- def render(view, **options)
109
- self.body = view.(**view_options.(request, self), **exposures.merge(options)).to_str
106
+ # @param view [Hanami::View] the view to render
107
+ # @param input [Hash] keyword arguments to pass to the view's `#call` method
108
+ #
109
+ # @api public
110
+ # @since 2.1.0
111
+ def render(view, **input)
112
+ view_input = {
113
+ **view_options.call(request, self),
114
+ **exposures,
115
+ **input
116
+ }
117
+
118
+ self.body = view.call(**view_input).to_str
110
119
  end
111
120
 
112
121
  # Returns the format for the response.
@@ -275,24 +284,26 @@ module Hanami
275
284
  #
276
285
  # @return [void]
277
286
  #
278
- # @see Config#public_directory
287
+ # @see Hanami::Action::Config#public_directory
288
+ # @see Hanami::Action::Rack::File
279
289
  #
280
290
  # @since 2.0.0
281
291
  # @api public
282
292
  def send_file(path)
283
293
  _send_file(
284
- Rack::File.new(path, @config.public_directory).call(env)
294
+ Action::Rack::File.new(path, @config.public_directory).call(env)
285
295
  )
286
296
  end
287
297
 
288
298
  # Send the file at the given path as the response, for a file anywhere in the file system.
289
299
  #
290
- # @see #send_file
291
- #
292
300
  # @param path [String, Pathname] path to the file to be sent
293
301
  #
294
302
  # @return [void]
295
303
  #
304
+ # @see #send_file
305
+ # @see Hanami::Action::Rack::File
306
+ #
296
307
  # @since 2.0.0
297
308
  # @api public
298
309
  def unsafe_send_file(path)
@@ -303,7 +314,7 @@ module Hanami
303
314
  end
304
315
 
305
316
  _send_file(
306
- Rack::File.new(path, directory).call(env)
317
+ Action::Rack::File.new(path, directory).call(env)
307
318
  )
308
319
  end
309
320
 
@@ -8,6 +8,6 @@ module Hanami
8
8
  #
9
9
  # @since 0.1.0
10
10
  # @api public
11
- VERSION = "2.1.0.beta2"
11
+ VERSION = "2.1.0.rc2"
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-controller
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.beta2
4
+ version: 2.1.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-04 00:00:00.000000000 Z
11
+ date: 2023-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: 2.1.rc
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: 2.1.rc
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: dry-configurable
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  - !ruby/object:Gem::Version
223
223
  version: 1.3.1
224
224
  requirements: []
225
- rubygems_version: 3.4.13
225
+ rubygems_version: 3.4.21
226
226
  signing_key:
227
227
  specification_version: 4
228
228
  summary: Complete, fast and testable actions for Rack and Hanami