sinatra 2.0.7 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sinatra might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/Gemfile +4 -1
- data/README.pt-br.md +2356 -329
- data/VERSION +1 -1
- data/lib/sinatra/base.rb +9 -8
- data/lib/sinatra/version.rb +1 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.8
|
data/lib/sinatra/base.rb
CHANGED
@@ -1019,7 +1019,7 @@ module Sinatra
|
|
1019
1019
|
|
1020
1020
|
params.delete("ignore") # TODO: better params handling, maybe turn it into "smart" object or detect changes
|
1021
1021
|
force_encoding(params)
|
1022
|
-
|
1022
|
+
@params = @params.merge(params) if params.any?
|
1023
1023
|
|
1024
1024
|
regexp_exists = pattern.is_a?(Mustermann::Regular) || (pattern.respond_to?(:patterns) && pattern.patterns.any? {|subpattern| subpattern.is_a?(Mustermann::Regular)} )
|
1025
1025
|
if regexp_exists
|
@@ -1038,7 +1038,8 @@ module Sinatra
|
|
1038
1038
|
@env['sinatra.error.params'] = @params
|
1039
1039
|
raise
|
1040
1040
|
ensure
|
1041
|
-
|
1041
|
+
params ||= {}
|
1042
|
+
params.each { |k, _| @params.delete(k) } unless @env['sinatra.error.params']
|
1042
1043
|
end
|
1043
1044
|
|
1044
1045
|
# No matching route was found or all routes passed. The default
|
@@ -1050,7 +1051,7 @@ module Sinatra
|
|
1050
1051
|
if @app
|
1051
1052
|
forward
|
1052
1053
|
else
|
1053
|
-
raise NotFound
|
1054
|
+
raise NotFound, "#{request.request_method} #{request.path_info}"
|
1054
1055
|
end
|
1055
1056
|
end
|
1056
1057
|
|
@@ -1345,19 +1346,19 @@ module Sinatra
|
|
1345
1346
|
# context as route handlers and may access/modify the request and
|
1346
1347
|
# response.
|
1347
1348
|
def before(path = /.*/, **options, &block)
|
1348
|
-
add_filter(:before, path, options, &block)
|
1349
|
+
add_filter(:before, path, **options, &block)
|
1349
1350
|
end
|
1350
1351
|
|
1351
1352
|
# Define an after filter; runs after all requests within the same
|
1352
1353
|
# context as route handlers and may access/modify the request and
|
1353
1354
|
# response.
|
1354
1355
|
def after(path = /.*/, **options, &block)
|
1355
|
-
add_filter(:after, path, options, &block)
|
1356
|
+
add_filter(:after, path, **options, &block)
|
1356
1357
|
end
|
1357
1358
|
|
1358
1359
|
# add a filter
|
1359
1360
|
def add_filter(type, path = /.*/, **options, &block)
|
1360
|
-
filters[type] << compile!(type, path, block, options)
|
1361
|
+
filters[type] << compile!(type, path, block, **options)
|
1361
1362
|
end
|
1362
1363
|
|
1363
1364
|
# Add a route condition. The route is considered non-matching when the
|
@@ -1601,7 +1602,7 @@ module Sinatra
|
|
1601
1602
|
|
1602
1603
|
def route(verb, path, options = {}, &block)
|
1603
1604
|
enable :empty_path_info if path == "" and empty_path_info.nil?
|
1604
|
-
signature = compile!(verb, path, block, options)
|
1605
|
+
signature = compile!(verb, path, block, **options)
|
1605
1606
|
(@routes[verb] ||= []) << signature
|
1606
1607
|
invoke_hook(:route_added, verb, path, block)
|
1607
1608
|
signature
|
@@ -1638,7 +1639,7 @@ module Sinatra
|
|
1638
1639
|
end
|
1639
1640
|
|
1640
1641
|
def compile(path, route_mustermann_opts = {})
|
1641
|
-
Mustermann.new(path, mustermann_opts.merge(route_mustermann_opts))
|
1642
|
+
Mustermann.new(path, **mustermann_opts.merge(route_mustermann_opts))
|
1642
1643
|
end
|
1643
1644
|
|
1644
1645
|
def setup_default_middleware(builder)
|
data/lib/sinatra/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Mizerany
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2020-01-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rack
|
@@ -47,14 +47,14 @@ dependencies:
|
|
47
47
|
requirements:
|
48
48
|
- - '='
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 2.0.
|
50
|
+
version: 2.0.8
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - '='
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: 2.0.
|
57
|
+
version: 2.0.8
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: mustermann
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|