Class: Xing::Services::LogJsonRequests

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) ⇒ LogJsonRequests

Returns a new instance of LogJsonRequests.



13
14
15
# File 'lib/xing/services/log_json_responses.rb', line 13

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/xing/services/log_json_responses.rb', line 17

def call(env)
  if defined?(Rails) and env["CONTENT_TYPE"] =~ APPJSON_RE
    log_string(env["rack.input"].read)
    env["rack.input"].rewind
  end
  @app.call(env)
end

#type_stringObject



25
26
27
# File 'lib/xing/services/log_json_responses.rb', line 25

def type_string
  "Request"
end