Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LimitPostBodySize
- attr_accessor :app, :max_size
- def initialize(app, max_size); @app, @max_size = app, max_size; end
- def call(env)
- if env['rack.input'].stat.size < @max_size
- @app.call(env)
- else
- [413, {'Content-Type' => 'text/plain'}, 'Request Entity Too Large']
- end
- end
- end
Add Comment
Please, Sign In to add comment