Class: UTF8Gatekeeper::Middleware
- Inherits:
-
Object
- Object
- UTF8Gatekeeper::Middleware
- Defined in:
- lib/utf8_gatekeeper/middleware.rb
Constant Summary collapse
- CHECK_ENV_KEYS =
%w(HTTP_REFERER PATH_INFO QUERY_STRING REQUEST_PATH REQUEST_URI HTTP_COOKIE)
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
6 7 8 |
# File 'lib/utf8_gatekeeper/middleware.rb', line 6 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/utf8_gatekeeper/middleware.rb', line 10 def call(env) if check?(env) @app.call(env) else [400, { 'Content-Type' => 'text/plain' }, ['Sorry, you need to use valid UTF8 if you want this to work']] end end |