Guest User

Untitled

a guest
Feb 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. class LimitPostBodySize
  2. attr_accessor :app, :max_size
  3. def initialize(app, max_size); @app, @max_size = app, max_size; end
  4. def call(env)
  5. if env['rack.input'].stat.size < @max_size
  6. @app.call(env)
  7. else
  8. [413, {'Content-Type' => 'text/plain'}, 'Request Entity Too Large']
  9. end
  10. end
  11. end
Add Comment
Please, Sign In to add comment