rack-app 5.10.1 → 5.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rack/app/error_handler.rb +2 -2
- data/lib/rack/app/instance_methods/payload.rb +2 -2
- data/lib/rack/app/instance_methods/redirect_to.rb +1 -1
- data/lib/rack/app/payload/parser/builder/formats.rb +3 -2
- data/lib/rack/app/router/base.rb +2 -2
- data/lib/rack/app/singleton_methods/middleware.rb +2 -2
- data/lib/rack/app/test.rb +1 -1
- data/lib/rack/app/test/singleton_methods.rb +5 -3
- data/lib/rack/app/test/utils.rb +1 -1
- data/lib/rack/app/utils.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 983dee78b91bcdb205f8897297ef37cd2ebf7e3a
|
4
|
+
data.tar.gz: b25e20aaaac647a04b6559ca59b9d4970f4a7670
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05075fc0dc6dad4d1f01f9c3a5b3683c4dd490733db795bffc4b34e192de70b694f0d7faa9c62f30ed097559a5a3e9089a1f4aec365a1a21a1edf3e8075dc644
|
7
|
+
data.tar.gz: 4f5d3a2ccff652a98c2a0369eee4ea7d823ddfc994c7984439620c9563857688ba616a31bedb1ccc658ab859d313cb56e505c114963532a9b8823a3eed63c089
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.10.
|
1
|
+
5.10.2
|
@@ -13,8 +13,8 @@ class Rack::App::ErrorHandler
|
|
13
13
|
nil
|
14
14
|
end
|
15
15
|
|
16
|
-
def execute_with_error_handling_for(instance
|
17
|
-
|
16
|
+
def execute_with_error_handling_for(instance)
|
17
|
+
yield
|
18
18
|
rescue *[Exception, @handlers.keys].flatten => ex
|
19
19
|
instance.instance_exec(ex, &get_handler(ex))
|
20
20
|
end
|
@@ -4,10 +4,10 @@ module Rack::App::InstanceMethods::Payload
|
|
4
4
|
request.env[Rack::App::Constants::ENV::PAYLOAD_GETTER].call
|
5
5
|
end
|
6
6
|
|
7
|
-
def payload_stream
|
7
|
+
def payload_stream
|
8
8
|
return nil unless @request.body.respond_to?(:gets)
|
9
9
|
while chunk = @request.body.gets
|
10
|
-
|
10
|
+
yield(chunk)
|
11
11
|
end
|
12
12
|
@request.body.rewind
|
13
13
|
nil
|
@@ -100,9 +100,10 @@ module Rack::App::Payload::Parser::Builder::Formats
|
|
100
100
|
last_name = nil
|
101
101
|
form_names.map(&:to_sym).each do |form_name|
|
102
102
|
last_name = form_name
|
103
|
+
unless respond_to?(form_name)
|
104
|
+
raise(NotImplementedError, "unknown formatter: #{last_name}")
|
105
|
+
end
|
103
106
|
__send__ form_name, builder
|
104
107
|
end
|
105
|
-
rescue NoMethodError
|
106
|
-
raise(NotImplementedError, "unknown formatter: #{last_name}")
|
107
108
|
end
|
108
109
|
end
|
data/lib/rack/app/router/base.rb
CHANGED
@@ -50,8 +50,8 @@ class Rack::App::Router::Base
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
def find_by_path_infos(env
|
54
|
-
|
53
|
+
def find_by_path_infos(env)
|
54
|
+
yield(raw_path_info(env)) || yield(formatted_path_info(env))
|
55
55
|
end
|
56
56
|
|
57
57
|
def get_request_method(env)
|
data/lib/rack/app/test.rb
CHANGED
@@ -14,7 +14,7 @@ module Rack::App::Test
|
|
14
14
|
|
15
15
|
def __send_rack_app_request__(request_method, *args)
|
16
16
|
properties = args.select { |e| e.is_a?(Hash) }.reduce({}, &:merge!)
|
17
|
-
url = args.
|
17
|
+
url = args.detect { |e| e.is_a?(String) } || properties.delete(:url)
|
18
18
|
mock_request = Rack::MockRequest.new(rack_app)
|
19
19
|
request_env = Rack::App::Test::Utils.env_by(properties)
|
20
20
|
return @last_response = mock_request.request(request_method.to_s.upcase, url, request_env)
|
@@ -12,9 +12,11 @@ module Rack::App::Test::SingletonMethods
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def in_this_context(name, &block)
|
15
|
-
let
|
16
|
-
|
17
|
-
|
15
|
+
if respond_to?(:let)
|
16
|
+
let(name, &block)
|
17
|
+
else
|
18
|
+
define_method(name, &block)
|
19
|
+
end
|
18
20
|
end
|
19
21
|
|
20
22
|
end
|
data/lib/rack/app/test/utils.rb
CHANGED
@@ -13,7 +13,7 @@ module Rack::App::Test::Utils
|
|
13
13
|
def env_by(properties)
|
14
14
|
|
15
15
|
properties = format_properties(properties)
|
16
|
-
env = properties[:headers].reduce({}) { |m, (k, v)| m.merge("HTTP_#{k.to_s.
|
16
|
+
env = properties[:headers].reduce({}) { |m, (k, v)| m.merge("HTTP_#{k.to_s.tr('-', '_').upcase}" => v.to_s) }
|
17
17
|
payload = properties.delete(:payload)
|
18
18
|
env["rack.input"]= ::Rack::Lint::InputWrapper.new(string_io_for(payload))
|
19
19
|
env[::Rack::QUERY_STRING]= Rack::App::Utils.encode_www_form(properties[:params].to_a)
|
data/lib/rack/app/utils.rb
CHANGED
@@ -56,7 +56,7 @@ module Rack::App::Utils
|
|
56
56
|
|
57
57
|
def join(*url_path_parts)
|
58
58
|
url_path_parts = [url_path_parts].flatten.compact.map(&:to_s)
|
59
|
-
File.join(*url_path_parts).
|
59
|
+
File.join(*url_path_parts).tr(File::Separator, '/').sub(/^\/?(.*)$/, '/\1')
|
60
60
|
end
|
61
61
|
|
62
62
|
def expand_path(file_path)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.10.
|
4
|
+
version: 5.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|