actionpack 5.0.0.beta3 → 5.0.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionpack might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +101 -16
- data/lib/abstract_controller/base.rb +2 -4
- data/lib/abstract_controller/error.rb +4 -0
- data/lib/abstract_controller/helpers.rb +2 -1
- data/lib/abstract_controller/rendering.rb +1 -0
- data/lib/action_controller/api.rb +20 -19
- data/lib/action_controller/metal/basic_implicit_render.rb +1 -1
- data/lib/action_controller/metal/conditional_get.rb +52 -21
- data/lib/action_controller/metal/cookies.rb +1 -1
- data/lib/action_controller/metal/data_streaming.rb +9 -10
- data/lib/action_controller/metal/force_ssl.rb +4 -4
- data/lib/action_controller/metal/http_authentication.rb +8 -3
- data/lib/action_controller/metal/implicit_render.rb +55 -17
- data/lib/action_controller/metal/instrumentation.rb +3 -2
- data/lib/action_controller/metal/live.rb +2 -2
- data/lib/action_controller/metal/mime_responds.rb +1 -1
- data/lib/action_controller/metal/redirecting.rb +1 -1
- data/lib/action_controller/metal/request_forgery_protection.rb +3 -2
- data/lib/action_controller/metal/rescue.rb +6 -2
- data/lib/action_controller/metal/strong_parameters.rb +30 -3
- data/lib/action_controller/renderer.rb +1 -1
- data/lib/action_controller/test_case.rb +2 -2
- data/lib/action_dispatch.rb +1 -1
- data/lib/action_dispatch/http/cache.rb +49 -15
- data/lib/action_dispatch/http/filter_parameters.rb +9 -3
- data/lib/action_dispatch/http/headers.rb +2 -2
- data/lib/action_dispatch/http/mime_types.rb +1 -1
- data/lib/action_dispatch/http/request.rb +0 -1
- data/lib/action_dispatch/journey/formatter.rb +7 -2
- data/lib/action_dispatch/journey/route.rb +1 -1
- data/lib/action_dispatch/middleware/callbacks.rb +10 -1
- data/lib/action_dispatch/middleware/exception_wrapper.rb +0 -1
- data/lib/action_dispatch/middleware/executor.rb +19 -0
- data/lib/action_dispatch/middleware/flash.rb +5 -0
- data/lib/action_dispatch/middleware/params_parser.rb +1 -0
- data/lib/action_dispatch/middleware/reloader.rb +12 -54
- data/lib/action_dispatch/middleware/ssl.rb +19 -3
- data/lib/action_dispatch/railtie.rb +2 -0
- data/lib/action_dispatch/request/session.rb +16 -10
- data/lib/action_dispatch/routing.rb +12 -3
- data/lib/action_dispatch/routing/inspector.rb +3 -3
- data/lib/action_dispatch/routing/mapper.rb +6 -3
- data/lib/action_dispatch/routing/route_set.rb +16 -15
- data/lib/action_dispatch/routing/url_for.rb +1 -1
- data/lib/action_dispatch/testing/assertions/routing.rb +1 -1
- data/lib/action_dispatch/testing/integration.rb +43 -27
- data/lib/action_pack/gem_version.rb +1 -1
- metadata +12 -11
- data/lib/action_dispatch/middleware/load_interlock.rb +0 -21
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'active_support/core_ext/hash/reverse_merge'
|
2
1
|
require 'active_support/core_ext/hash/slice'
|
3
2
|
require 'active_support/core_ext/enumerable'
|
4
3
|
require 'active_support/core_ext/array/extract_options'
|
@@ -138,6 +137,10 @@ module ActionDispatch
|
|
138
137
|
@conditions = Hash[conditions]
|
139
138
|
@defaults = formats[:defaults].merge(@defaults).merge(normalize_defaults(options))
|
140
139
|
|
140
|
+
if path_params.include?(:action) && !@requirements.key?(:action)
|
141
|
+
@defaults[:action] ||= 'index'
|
142
|
+
end
|
143
|
+
|
141
144
|
@required_defaults = (split_options[:required_defaults] || []).map(&:first)
|
142
145
|
end
|
143
146
|
|
@@ -824,7 +827,7 @@ module ActionDispatch
|
|
824
827
|
URL_OPTIONS.include?(k) && (v.is_a?(String) || v.is_a?(Fixnum))
|
825
828
|
end
|
826
829
|
|
827
|
-
(options[:defaults]
|
830
|
+
options[:defaults] = defaults.merge(options[:defaults] || {})
|
828
831
|
else
|
829
832
|
block, options[:constraints] = options[:constraints], {}
|
830
833
|
end
|
@@ -1598,7 +1601,7 @@ module ActionDispatch
|
|
1598
1601
|
route_options = options.dup
|
1599
1602
|
if _path && option_path
|
1600
1603
|
ActiveSupport::Deprecation.warn <<-eowarn
|
1601
|
-
Specifying strings for both :path and the route path is deprecated.
|
1604
|
+
Specifying strings for both :path and the route path is deprecated. Change things like this:
|
1602
1605
|
|
1603
1606
|
match #{_path.inspect}, :path => #{option_path.inspect}
|
1604
1607
|
|
@@ -289,7 +289,7 @@ module ActionDispatch
|
|
289
289
|
if last.permitted?
|
290
290
|
args.pop.to_h
|
291
291
|
else
|
292
|
-
raise ArgumentError,
|
292
|
+
raise ArgumentError, ActionDispatch::Routing::INSECURE_URL_PARAMETERS_MESSAGE
|
293
293
|
end
|
294
294
|
end
|
295
295
|
helper.call self, args, options
|
@@ -513,6 +513,21 @@ module ActionDispatch
|
|
513
513
|
|
514
514
|
route = @set.add_route(name, mapping)
|
515
515
|
named_routes[name] = route if name
|
516
|
+
|
517
|
+
if route.segment_keys.include?(:controller)
|
518
|
+
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
519
|
+
Using a dynamic :controller segment in a route is deprecated and
|
520
|
+
will be removed in Rails 5.1.
|
521
|
+
MSG
|
522
|
+
end
|
523
|
+
|
524
|
+
if route.segment_keys.include?(:action)
|
525
|
+
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
526
|
+
Using a dynamic :action segment in a route is deprecated and
|
527
|
+
will be removed in Rails 5.1.
|
528
|
+
MSG
|
529
|
+
end
|
530
|
+
|
516
531
|
route
|
517
532
|
end
|
518
533
|
|
@@ -533,12 +548,10 @@ module ActionDispatch
|
|
533
548
|
@recall = recall
|
534
549
|
@set = set
|
535
550
|
|
536
|
-
normalize_recall!
|
537
551
|
normalize_options!
|
538
552
|
normalize_controller_action_id!
|
539
553
|
use_relative_controller!
|
540
554
|
normalize_controller!
|
541
|
-
normalize_action!
|
542
555
|
end
|
543
556
|
|
544
557
|
def controller
|
@@ -557,11 +570,6 @@ module ActionDispatch
|
|
557
570
|
end
|
558
571
|
end
|
559
572
|
|
560
|
-
# Set 'index' as default action for recall
|
561
|
-
def normalize_recall!
|
562
|
-
@recall[:action] ||= 'index'
|
563
|
-
end
|
564
|
-
|
565
573
|
def normalize_options!
|
566
574
|
# If an explicit :controller was given, always make :action explicit
|
567
575
|
# too, so that action expiry works as expected for things like
|
@@ -615,13 +623,6 @@ module ActionDispatch
|
|
615
623
|
end
|
616
624
|
end
|
617
625
|
|
618
|
-
# Move 'index' action from options to recall
|
619
|
-
def normalize_action!
|
620
|
-
if @options[:action] == 'index'.freeze
|
621
|
-
@recall[:action] = @options.delete(:action)
|
622
|
-
end
|
623
|
-
end
|
624
|
-
|
625
626
|
# Generates a path from routes, returns [path, params].
|
626
627
|
# If no route is generated the formatter will raise ActionController::UrlGenerationError
|
627
628
|
def generate
|
@@ -173,7 +173,7 @@ module ActionDispatch
|
|
173
173
|
route_name)
|
174
174
|
when ActionController::Parameters
|
175
175
|
unless options.permitted?
|
176
|
-
raise ArgumentError.new(
|
176
|
+
raise ArgumentError.new(ActionDispatch::Routing::INSECURE_URL_PARAMETERS_MESSAGE)
|
177
177
|
end
|
178
178
|
route_name = options.delete :use_route
|
179
179
|
_routes.url_for(options.to_h.symbolize_keys.
|
@@ -117,7 +117,7 @@ module ActionDispatch
|
|
117
117
|
# # Tests a route, providing a defaults hash
|
118
118
|
# assert_routing 'controller/action/9', {id: "9", item: "square"}, {controller: "controller", action: "action"}, {}, {item: "square"}
|
119
119
|
#
|
120
|
-
# # Tests a route with
|
120
|
+
# # Tests a route with an HTTP method
|
121
121
|
# assert_routing({ method: 'put', path: '/product/321' }, { controller: "product", action: "update", id: "321" })
|
122
122
|
def assert_routing(path, options, defaults={}, extras={}, message=nil)
|
123
123
|
assert_recognizes(options, path, extras, message)
|
@@ -95,7 +95,7 @@ module ActionDispatch
|
|
95
95
|
|
96
96
|
ActiveSupport::Deprecation.warn(<<-MSG.strip_heredoc)
|
97
97
|
xhr and xml_http_request methods are deprecated in favor of
|
98
|
-
`get "/posts", xhr: true` and `post "/posts/1", xhr: true
|
98
|
+
`get "/posts", xhr: true` and `post "/posts/1", xhr: true`.
|
99
99
|
MSG
|
100
100
|
|
101
101
|
process(request_method, path, params: params, headers: headers, xhr: true)
|
@@ -122,6 +122,7 @@ module ActionDispatch
|
|
122
122
|
# params: { ref_id: 14 },
|
123
123
|
# headers: { "X-Test-Header" => "testvalue" }
|
124
124
|
def request_via_redirect(http_method, path, *args)
|
125
|
+
ActiveSupport::Deprecation.warn('`request_via_redirect` is deprecated and will be removed in Rails 5.1. Please use `follow_redirect!` manually after the request call for the same behavior.')
|
125
126
|
process_with_kwargs(http_method, path, *args)
|
126
127
|
|
127
128
|
follow_redirect! while redirect?
|
@@ -131,35 +132,35 @@ module ActionDispatch
|
|
131
132
|
# Performs a GET request, following any subsequent redirect.
|
132
133
|
# See +request_via_redirect+ for more information.
|
133
134
|
def get_via_redirect(path, *args)
|
134
|
-
ActiveSupport::Deprecation.warn('`get_via_redirect` is deprecated and will be removed in Rails 5.1. Please use follow_redirect
|
135
|
+
ActiveSupport::Deprecation.warn('`get_via_redirect` is deprecated and will be removed in Rails 5.1. Please use `follow_redirect!` manually after the request call for the same behavior.')
|
135
136
|
request_via_redirect(:get, path, *args)
|
136
137
|
end
|
137
138
|
|
138
139
|
# Performs a POST request, following any subsequent redirect.
|
139
140
|
# See +request_via_redirect+ for more information.
|
140
141
|
def post_via_redirect(path, *args)
|
141
|
-
ActiveSupport::Deprecation.warn('`post_via_redirect` is deprecated and will be removed in Rails 5.1. Please use follow_redirect
|
142
|
+
ActiveSupport::Deprecation.warn('`post_via_redirect` is deprecated and will be removed in Rails 5.1. Please use `follow_redirect!` manually after the request call for the same behavior.')
|
142
143
|
request_via_redirect(:post, path, *args)
|
143
144
|
end
|
144
145
|
|
145
146
|
# Performs a PATCH request, following any subsequent redirect.
|
146
147
|
# See +request_via_redirect+ for more information.
|
147
148
|
def patch_via_redirect(path, *args)
|
148
|
-
ActiveSupport::Deprecation.warn('`patch_via_redirect` is deprecated and will be removed in Rails 5.1. Please use follow_redirect
|
149
|
+
ActiveSupport::Deprecation.warn('`patch_via_redirect` is deprecated and will be removed in Rails 5.1. Please use `follow_redirect!` manually after the request call for the same behavior.')
|
149
150
|
request_via_redirect(:patch, path, *args)
|
150
151
|
end
|
151
152
|
|
152
153
|
# Performs a PUT request, following any subsequent redirect.
|
153
154
|
# See +request_via_redirect+ for more information.
|
154
155
|
def put_via_redirect(path, *args)
|
155
|
-
ActiveSupport::Deprecation.warn('`put_via_redirect` is deprecated and will be removed in Rails 5.1. Please use follow_redirect
|
156
|
+
ActiveSupport::Deprecation.warn('`put_via_redirect` is deprecated and will be removed in Rails 5.1. Please use `follow_redirect!` manually after the request call for the same behavior.')
|
156
157
|
request_via_redirect(:put, path, *args)
|
157
158
|
end
|
158
159
|
|
159
160
|
# Performs a DELETE request, following any subsequent redirect.
|
160
161
|
# See +request_via_redirect+ for more information.
|
161
162
|
def delete_via_redirect(path, *args)
|
162
|
-
ActiveSupport::Deprecation.warn('`delete_via_redirect` is deprecated and will be removed in Rails 5.1. Please use follow_redirect
|
163
|
+
ActiveSupport::Deprecation.warn('`delete_via_redirect` is deprecated and will be removed in Rails 5.1. Please use `follow_redirect!` manually after the request call for the same behavior.')
|
163
164
|
request_via_redirect(:delete, path, *args)
|
164
165
|
end
|
165
166
|
end
|
@@ -735,34 +736,49 @@ module ActionDispatch
|
|
735
736
|
# Consult the Rails Testing Guide for more.
|
736
737
|
|
737
738
|
class IntegrationTest < ActiveSupport::TestCase
|
738
|
-
|
739
|
-
|
740
|
-
|
739
|
+
module UrlOptions
|
740
|
+
extend ActiveSupport::Concern
|
741
|
+
def url_options
|
742
|
+
integration_session.url_options
|
743
|
+
end
|
744
|
+
end
|
741
745
|
|
742
|
-
|
746
|
+
module Behavior
|
747
|
+
extend ActiveSupport::Concern
|
743
748
|
|
744
|
-
|
745
|
-
|
746
|
-
end
|
749
|
+
include Integration::Runner
|
750
|
+
include ActionController::TemplateAssertions
|
747
751
|
|
748
|
-
|
749
|
-
|
750
|
-
|
752
|
+
included do
|
753
|
+
include ActionDispatch::Routing::UrlFor
|
754
|
+
include UrlOptions # don't let UrlFor override the url_options method
|
755
|
+
ActiveSupport.run_load_hooks(:action_dispatch_integration_test, self)
|
756
|
+
@@app = nil
|
757
|
+
end
|
751
758
|
|
752
|
-
|
753
|
-
|
754
|
-
|
759
|
+
module ClassMethods
|
760
|
+
def app
|
761
|
+
defined?(@@app) ? @@app : ActionDispatch.test_app
|
762
|
+
end
|
755
763
|
|
756
|
-
|
757
|
-
|
758
|
-
|
764
|
+
def app=(app)
|
765
|
+
@@app = app
|
766
|
+
end
|
759
767
|
|
760
|
-
|
761
|
-
|
762
|
-
|
768
|
+
def register_encoder(*args)
|
769
|
+
Integration::Session::RequestEncoder.register_encoder(*args)
|
770
|
+
end
|
771
|
+
end
|
763
772
|
|
764
|
-
|
765
|
-
|
773
|
+
def app
|
774
|
+
super || self.class.app
|
775
|
+
end
|
776
|
+
|
777
|
+
def document_root_element
|
778
|
+
html_document.root
|
779
|
+
end
|
766
780
|
end
|
781
|
+
|
782
|
+
include Behavior
|
767
783
|
end
|
768
784
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.0.
|
4
|
+
version: 5.0.0.beta4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.0.0.
|
19
|
+
version: 5.0.0.beta4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.0.0.
|
26
|
+
version: 5.0.0.beta4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,28 +98,28 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - '='
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 5.0.0.
|
101
|
+
version: 5.0.0.beta4
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - '='
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: 5.0.0.
|
108
|
+
version: 5.0.0.beta4
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: activemodel
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - '='
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: 5.0.0.
|
115
|
+
version: 5.0.0.beta4
|
116
116
|
type: :development
|
117
117
|
prerelease: false
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
120
|
- - '='
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: 5.0.0.
|
122
|
+
version: 5.0.0.beta4
|
123
123
|
description: Web apps on Rails. Simple, battle-tested conventions for building and
|
124
124
|
testing MVC web applications. Works with any Rack-compatible server.
|
125
125
|
email: david@loudthinking.com
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- lib/abstract_controller/caching/fragments.rb
|
138
138
|
- lib/abstract_controller/callbacks.rb
|
139
139
|
- lib/abstract_controller/collector.rb
|
140
|
+
- lib/abstract_controller/error.rb
|
140
141
|
- lib/abstract_controller/helpers.rb
|
141
142
|
- lib/abstract_controller/logger.rb
|
142
143
|
- lib/abstract_controller/railties/routes_helpers.rb
|
@@ -223,8 +224,8 @@ files:
|
|
223
224
|
- lib/action_dispatch/middleware/cookies.rb
|
224
225
|
- lib/action_dispatch/middleware/debug_exceptions.rb
|
225
226
|
- lib/action_dispatch/middleware/exception_wrapper.rb
|
227
|
+
- lib/action_dispatch/middleware/executor.rb
|
226
228
|
- lib/action_dispatch/middleware/flash.rb
|
227
|
-
- lib/action_dispatch/middleware/load_interlock.rb
|
228
229
|
- lib/action_dispatch/middleware/params_parser.rb
|
229
230
|
- lib/action_dispatch/middleware/public_exceptions.rb
|
230
231
|
- lib/action_dispatch/middleware/reloader.rb
|
@@ -280,7 +281,7 @@ files:
|
|
280
281
|
- lib/action_pack.rb
|
281
282
|
- lib/action_pack/gem_version.rb
|
282
283
|
- lib/action_pack/version.rb
|
283
|
-
homepage: http://
|
284
|
+
homepage: http://rubyonrails.org
|
284
285
|
licenses:
|
285
286
|
- MIT
|
286
287
|
metadata: {}
|
@@ -301,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
302
|
requirements:
|
302
303
|
- none
|
303
304
|
rubyforge_project:
|
304
|
-
rubygems_version: 2.
|
305
|
+
rubygems_version: 2.6.4
|
305
306
|
signing_key:
|
306
307
|
specification_version: 4
|
307
308
|
summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'active_support/dependencies'
|
2
|
-
require 'rack/body_proxy'
|
3
|
-
|
4
|
-
module ActionDispatch
|
5
|
-
class LoadInterlock
|
6
|
-
def initialize(app)
|
7
|
-
@app = app
|
8
|
-
end
|
9
|
-
|
10
|
-
def call(env)
|
11
|
-
interlock = ActiveSupport::Dependencies.interlock
|
12
|
-
interlock.start_running
|
13
|
-
response = @app.call(env)
|
14
|
-
body = Rack::BodyProxy.new(response[2]) { interlock.done_running }
|
15
|
-
response[2] = body
|
16
|
-
response
|
17
|
-
ensure
|
18
|
-
interlock.done_running unless body
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|