Class: Iron::OauthBodyLimit
- Inherits:
-
Object
- Object
- Iron::OauthBodyLimit
- Defined in:
- lib/iron/oauth_body_limit.rb
Overview
Rack::MethodOverride parses form-encoded POST bodies before the request reaches any controller, so the public OAuth endpoints installed at the host root get their size ceiling from the very front of the middleware stack, ahead of anything that might read the body.
Constant Summary collapse
- PATHS =
%w[ /oauth/authorize /oauth/token /oauth/register ].freeze
- MAX_BYTES =
64 * 1024
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ OauthBodyLimit
constructor
A new instance of OauthBodyLimit.
Constructor Details
#initialize(app) ⇒ OauthBodyLimit
12 13 14 |
# File 'lib/iron/oauth_body_limit.rb', line 12 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/iron/oauth_body_limit.rb', line 16 def call(env) if guarded?(env) && oversized?(env) [ 413, { "content-length" => "0" }, [] ] else @app.call(env) end end |