Class: Xing::Services::LogJsonResponses

Inherits:
LogJson
  • Object
show all
Defined in:
lib/xing/services/log_json_responses.rb

Constant Summary

Constants inherited from LogJson

Xing::Services::LogJson::APPJSON_RE

Instance Method Summary collapse

Methods inherited from LogJson

#log_string

Constructor Details

#initialize(app) ⇒ LogJsonResponses

Returns a new instance of LogJsonResponses.



31
32
33
# File 'lib/xing/services/log_json_responses.rb', line 31

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/xing/services/log_json_responses.rb', line 35

def call(env)
  @app.call(env).tap do |status, headers, response|
    if defined?(Rails) and headers["Content-Type"] =~ APPJSON_RE
      log_string(response.body)
    end
  end
end

#type_stringObject



43
44
45
# File 'lib/xing/services/log_json_responses.rb', line 43

def type_string
  "Response"
end