Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mostly remove the ParamsParser middleware
This can still be added to the middleware stack, but is really not
necessary.  I'll follow up with a commit that deprecates the constant
  • Loading branch information
tenderlove committed Sep 18, 2015
1 parent a933461 commit 38d2bf5
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 16 deletions.
1 change: 0 additions & 1 deletion actionpack/test/abstract_unit.rb
Expand Up @@ -104,7 +104,6 @@ def self.build_app(routes = nil)
middleware.use ActionDispatch::ShowExceptions, ActionDispatch::PublicExceptions.new("#{FIXTURE_LOAD_PATH}/public")
middleware.use ActionDispatch::DebugExceptions
middleware.use ActionDispatch::Callbacks
middleware.use ActionDispatch::ParamsParser
middleware.use ActionDispatch::Cookies
middleware.use ActionDispatch::Flash
middleware.use Rack::Head
Expand Down
1 change: 0 additions & 1 deletion actionview/test/abstract_unit.rb
Expand Up @@ -151,7 +151,6 @@ def self.build_app(routes = nil)
middleware.use ActionDispatch::ShowExceptions, ActionDispatch::PublicExceptions.new("#{FIXTURE_LOAD_PATH}/public")
middleware.use ActionDispatch::DebugExceptions
middleware.use ActionDispatch::Callbacks
middleware.use ActionDispatch::ParamsParser
middleware.use ActionDispatch::Cookies
middleware.use ActionDispatch::Flash
middleware.use Rack::Head
Expand Down
7 changes: 3 additions & 4 deletions guides/source/api_app.md
Expand Up @@ -194,7 +194,6 @@ An API application comes with the following middlewares by default:
- `ActionDispatch::RemoteIp`
- `ActionDispatch::Reloader`
- `ActionDispatch::Callbacks`
- `ActionDispatch::ParamsParser`
- `Rack::Head`
- `Rack::ConditionalGet`
- `Rack::ETag`
Expand Down Expand Up @@ -292,9 +291,9 @@ instructions in the `Rack::Sendfile` documentation.
NOTE: The `Rack::Sendfile` middleware is always outside of the `Rack::Lock`
mutex, even in single-threaded applications.

### Using ActionDispatch::ParamsParser
### Using ActionDispatch::Request

`ActionDispatch::ParamsParser` will take parameters from the client in the JSON
`ActionDispatch::Request#params` will take parameters from the client in the JSON
format and make them available in your controller inside `params`.

To use this, your client will need to make a request with JSON-encoded parameters
Expand All @@ -313,7 +312,7 @@ jQuery.ajax({
});
```

`ActionDispatch::ParamsParser` will see the `Content-Type` and your parameters
`ActionDispatch::Request` will see the `Content-Type` and your parameters
will be:

```ruby
Expand Down
2 changes: 1 addition & 1 deletion guides/source/command_line.md
Expand Up @@ -412,7 +412,7 @@ Ruby version 2.2.2 (x86_64-linux)
RubyGems version 2.4.6
Rack version 1.6
JavaScript Runtime Node.js (V8)
Middleware Rack::Sendfile, ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007ffd131a7c88>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, Rack::Head, Rack::ConditionalGet, Rack::ETag
Middleware Rack::Sendfile, ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007ffd131a7c88>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, Rack::Head, Rack::ConditionalGet, Rack::ETag
Application root /home/foobar/commandsapp
Environment development
Database adapter sqlite3
Expand Down
1 change: 0 additions & 1 deletion guides/source/configuring.md
Expand Up @@ -214,7 +214,6 @@ Every Rails application comes with a standard set of middleware which it uses in
* `ActionDispatch::Cookies` sets cookies for the request.
* `ActionDispatch::Session::CookieStore` is responsible for storing the session in cookies. An alternate middleware can be used for this by changing the `config.action_controller.session_store` to an alternate value. Additionally, options passed to this can be configured by using `config.action_controller.session_options`.
* `ActionDispatch::Flash` sets up the `flash` keys. Only available if `config.action_controller.session_store` is set to a value.
* `ActionDispatch::ParamsParser` parses out parameters from the request into `params`.
* `Rack::MethodOverride` allows the method to be overridden if `params[:_method]` is set. This is the middleware which supports the PATCH, PUT, and DELETE HTTP method types.
* `Rack::Head` converts HEAD requests to GET requests and serves them as so.

Expand Down
5 changes: 0 additions & 5 deletions guides/source/rails_on_rack.md
Expand Up @@ -121,7 +121,6 @@ use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
Expand Down Expand Up @@ -284,10 +283,6 @@ Much of Action Controller's functionality is implemented as Middlewares. The fol

* Sets up the flash keys. Only available if `config.action_controller.session_store` is set to a value.

**`ActionDispatch::ParamsParser`**

* Parses out parameters from the request into `params`.

**`Rack::Head`**

* Converts HEAD requests to `GET` requests and serves them as so.
Expand Down
1 change: 0 additions & 1 deletion railties/lib/rails/application/default_middleware_stack.rb
Expand Up @@ -72,7 +72,6 @@ def build_stack
middleware.use ::ActionDispatch::Flash
end

middleware.use ::ActionDispatch::ParamsParser
middleware.use ::Rack::Head
middleware.use ::Rack::ConditionalGet
middleware.use ::Rack::ETag, "no-cache"
Expand Down
2 changes: 0 additions & 2 deletions railties/test/application/middleware_test.rb
Expand Up @@ -43,7 +43,6 @@ def app
"ActionDispatch::Cookies",
"ActionDispatch::Session::CookieStore",
"ActionDispatch::Flash",
"ActionDispatch::ParamsParser",
"Rack::Head",
"Rack::ConditionalGet",
"Rack::ETag"
Expand All @@ -70,7 +69,6 @@ def app
"ActionDispatch::Callbacks",
"ActiveRecord::ConnectionAdapters::ConnectionManagement",
"ActiveRecord::QueryCache",
"ActionDispatch::ParamsParser",
"Rack::Head",
"Rack::ConditionalGet",
"Rack::ETag"
Expand Down

0 comments on commit 38d2bf5

Please sign in to comment.