Class: ElmerFudd::JsonFilter
- Inherits:
-
Object
- Object
- ElmerFudd::JsonFilter
- Extended by:
- Filter
- Defined in:
- lib/ElmerFudd/json_filter.rb
Class Method Summary collapse
Methods included from Filter
Class Method Details
.call(env, message, filters) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/ElmerFudd/json_filter.rb', line 9 def self.call(env, , filters) .payload = JSON.parse(.payload) {result: call_next(env, , filters)}.to_json rescue JSON::ParserError env.logger.error "Ignoring invalid JSON: #{.payload}" end |
.setup(handler) ⇒ Object
5 6 7 |
# File 'lib/ElmerFudd/json_filter.rb', line 5 def self.setup(handler) handler.call_reply_content_type = 'application/json' end |