hanami-router 2.0.0.alpha2 → 2.0.0.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/hanami/router.rb +5 -21
- data/lib/hanami/router/prefix.rb +2 -0
- data/lib/hanami/router/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fab23d35a0e2c1e71ec08a112f95f35a2c21eed5fb3ab45f231a2a7fc500cc31
|
4
|
+
data.tar.gz: 85c7e6ab36e321fb04235f088f3f479f542e98cf00e5ae7d642bb323bb42d969
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ce90e7659b29b0571742eb972442ea27a4d51d1ea5500f9d25f943fe7e6a5e9b04598a1289a4c50f107289ea7162708a78e4825564b4ef056ee30a5765a63d6
|
7
|
+
data.tar.gz: b953c5d251e8cfb6f698bb6cea77df0dec2ff194bf51fe091d7fb4464ffad135c0760d328f9e50ae49f6cd48c45171b6ef4c55dc42f64c924cfd6d631cde5250
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# Hanami::Router
|
2
2
|
Rack compatible HTTP router for Ruby
|
3
3
|
|
4
|
+
## v2.0.0.alpha3 - 2020-05-20
|
5
|
+
### Fixed
|
6
|
+
- [Luca Guidi] `Hanami::Router#initialize` do not yield block if not given
|
7
|
+
- [Luca Guidi] Ensure to not accidentally cache response headers for HTTP 404 and 405
|
8
|
+
- [Luca Guidi] Ensure scoped root to not be added as trailing slash
|
9
|
+
|
4
10
|
## v2.0.0.alpha2 - 2020-02-19
|
5
11
|
### Added
|
6
12
|
- [Luca Guidi] Block syntax. Routes definition accept a block which returning value is the body of the Rack response.
|
data/lib/hanami/router.rb
CHANGED
@@ -71,7 +71,7 @@ module Hanami
|
|
71
71
|
@variable = {}
|
72
72
|
@globbed = {}
|
73
73
|
@mounted = {}
|
74
|
-
instance_eval(&blk)
|
74
|
+
instance_eval(&blk) if blk
|
75
75
|
end
|
76
76
|
|
77
77
|
# Resolve the given Rack env to a registered endpoint and invokes it.
|
@@ -631,13 +631,13 @@ module Hanami
|
|
631
631
|
# @since 2.0.0
|
632
632
|
# @api private
|
633
633
|
def not_allowed(env)
|
634
|
-
(_not_allowed_fixed(env) || _not_allowed_variable(env)) and return
|
634
|
+
(_not_allowed_fixed(env) || _not_allowed_variable(env)) and return [405, { "Content-Length" => "11" }, ["Not Allowed"]]
|
635
635
|
end
|
636
636
|
|
637
637
|
# @since 2.0.0
|
638
638
|
# @api private
|
639
639
|
def not_found
|
640
|
-
|
640
|
+
[404, { "Content-Length" => "9" }, ["Not Found"]]
|
641
641
|
end
|
642
642
|
|
643
643
|
protected
|
@@ -666,7 +666,7 @@ module Hanami
|
|
666
666
|
url = path(env, params)
|
667
667
|
return env_for(url, params, options) # rubocop:disable Style/RedundantReturn
|
668
668
|
rescue Hanami::Router::InvalidRouteException
|
669
|
-
|
669
|
+
{} # Empty Rack env
|
670
670
|
end
|
671
671
|
else
|
672
672
|
env
|
@@ -691,31 +691,15 @@ module Hanami
|
|
691
691
|
# @api private
|
692
692
|
DEFAULT_REDIRECT_CODE = 301
|
693
693
|
|
694
|
-
# @since 2.0.0
|
695
|
-
# @api private
|
696
|
-
NOT_FOUND = [404, { "Content-Length" => "9" }, ["Not Found"]].freeze
|
697
|
-
|
698
|
-
# @since 2.0.0
|
699
|
-
# @api private
|
700
|
-
NOT_ALLOWED = [405, { "Content-Length" => "11" }, ["Not Allowed"]].freeze
|
701
|
-
|
702
694
|
# @since 2.0.0
|
703
695
|
# @api private
|
704
696
|
PARAMS = "router.params"
|
705
697
|
|
706
|
-
# @since 2.0.0
|
707
|
-
# @api private
|
708
|
-
EMPTY_PARAMS = {}.freeze
|
709
|
-
|
710
|
-
# @since 2.0.0
|
711
|
-
# @api private
|
712
|
-
EMPTY_RACK_ENV = {}.freeze
|
713
|
-
|
714
698
|
# @since 2.0.0
|
715
699
|
# @api private
|
716
700
|
def lookup(env)
|
717
701
|
endpoint = fixed(env)
|
718
|
-
return [endpoint,
|
702
|
+
return [endpoint, {}] if endpoint
|
719
703
|
|
720
704
|
variable(env) || globbed(env) || mounted(env)
|
721
705
|
end
|
data/lib/hanami/router/prefix.rb
CHANGED
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.
|
4
|
+
version: 2.0.0.alpha3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: 1.3.1
|
163
163
|
requirements: []
|
164
|
-
rubygems_version: 3.1.
|
164
|
+
rubygems_version: 3.1.3
|
165
165
|
signing_key:
|
166
166
|
specification_version: 4
|
167
167
|
summary: Rack compatible HTTP router for Ruby and Hanami
|