hanami-router 2.0.0.rc1 → 2.0.0

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: dc0a68636ae47869944fc0c76f262c420356d3fbf10bd12b270692f48d3ea7bb
4
- data.tar.gz: cb653be9037e33f02a05bcbf2048109d64e561afafaa03c8ed353b4b3183d672
3
+ metadata.gz: d1d74dfb9252f6462cb018bd567261aad94f83ea6837bb78f3d597dd9b62d0c5
4
+ data.tar.gz: 30c7f9425d0ad82d0c3059ed8a2d8fcc5e1a1a11092caf5f725338748451fddc
5
5
  SHA512:
6
- metadata.gz: 4e50ba3c0279d9c26a1ef882127ef7d02ca39cb5ebab25589799ab7190e4562a40e57d0dcbcfe285b1e9dc7ab312dedc0ebf2553d4da3afc921821a8d23cc233
7
- data.tar.gz: b6f390eb1750d6e596bb1064573467fbd8d5ceccb3bbf0e34a8ab021dd1162d4fc88a8edee4d36a221d053a8ee3d656114004ac6ebbb9b87fc43636bd8715004
6
+ metadata.gz: 1f351789e9d4f24ef65cfdb6e19868e56c612b2f222dfd2f250f15bddfdcf00fb9d7146a5b4bd978fa2cf5b067b2dc1a96f9cf0430f028240a4c6543075cd0a1
7
+ data.tar.gz: 7019f2ef7c57177041495e7614992b117548d5d0eeace16d4784a9dc07b678d1d49e0987a6f750fd51b342cd5b86136fe393cef2d1fa126250a07ff8887bc1fe
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Rack compatible HTTP router for Ruby
4
4
 
5
+ ## v2.0.0 - 2022-11-22
6
+
7
+ ### Fixed
8
+
9
+ - [Luca Guidi] Don't parse request body when Body Parser already parsed it
10
+
5
11
  ## v2.0.0.rc1 - 2022-11-08
6
12
 
7
13
  ### Fixed
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "hanami/router/params"
4
4
  require "hanami/middleware/error"
5
+ require_relative "../router/constants"
5
6
 
6
7
  module Hanami
7
8
  module Middleware
@@ -27,9 +28,6 @@ module Hanami
27
28
  # @api private
28
29
  ROUTER_PARAMS = "router.params"
29
30
 
30
- # @api private
31
- ROUTER_PARSED_BODY = "router.parsed_body"
32
-
33
31
  # @api private
34
32
  FALLBACK_KEY = "_"
35
33
 
@@ -47,8 +45,8 @@ module Hanami
47
45
  env[RACK_INPUT].rewind # somebody might try to read this stream
48
46
 
49
47
  if (parser = @parsers[media_type(env)])
50
- env[ROUTER_PARSED_BODY] = parser.parse(body)
51
- env[ROUTER_PARAMS] = _symbolize(env[ROUTER_PARSED_BODY])
48
+ env[Router::ROUTER_PARSED_BODY] = parser.parse(body)
49
+ env[ROUTER_PARAMS] = _symbolize(env[Router::ROUTER_PARSED_BODY])
52
50
  end
53
51
 
54
52
  @app.call(env)
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hanami
4
+ class Router
5
+ # @api private
6
+ # @since 2.0.0
7
+ ROUTER_PARSED_BODY = "router.parsed_body"
8
+ end
9
+ end
@@ -7,6 +7,6 @@ module Hanami
7
7
  # @return [String]
8
8
  #
9
9
  # @api public
10
- VERSION = "2.0.0.rc1"
10
+ VERSION = "2.0.0"
11
11
  end
12
12
  end
data/lib/hanami/router.rb CHANGED
@@ -10,6 +10,7 @@ module Hanami
10
10
  # @since 0.1.0
11
11
  class Router
12
12
  require "hanami/router/version"
13
+ require "hanami/router/constants"
13
14
  require "hanami/router/errors"
14
15
  require "hanami/router/segment"
15
16
  require "hanami/router/redirect"
@@ -919,7 +920,7 @@ module Hanami
919
920
  params ||= {}
920
921
  env[PARAMS] ||= {}
921
922
 
922
- if (input = env[::Rack::RACK_INPUT]) and input.rewind
923
+ if !env.key?(ROUTER_PARSED_BODY) && (input = env[::Rack::RACK_INPUT]) and input.rewind
923
924
  env[PARAMS].merge!(::Rack::Utils.parse_nested_query(input.read))
924
925
  input.rewind
925
926
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-router
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-08 00:00:00.000000000 Z
11
+ date: 2022-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -164,6 +164,7 @@ files:
164
164
  - lib/hanami/middleware/trie.rb
165
165
  - lib/hanami/router.rb
166
166
  - lib/hanami/router/block.rb
167
+ - lib/hanami/router/constants.rb
167
168
  - lib/hanami/router/errors.rb
168
169
  - lib/hanami/router/formatter/csv.rb
169
170
  - lib/hanami/router/formatter/human_friendly.rb
@@ -194,11 +195,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
194
195
  version: '3.0'
195
196
  required_rubygems_version: !ruby/object:Gem::Requirement
196
197
  requirements:
197
- - - ">"
198
+ - - ">="
198
199
  - !ruby/object:Gem::Version
199
- version: 1.3.1
200
+ version: '0'
200
201
  requirements: []
201
- rubygems_version: 3.3.3
202
+ rubygems_version: 3.3.7
202
203
  signing_key:
203
204
  specification_version: 4
204
205
  summary: Rack compatible HTTP router for Ruby and Hanami