Closed namelessnotion closed 8 years ago
When using faraday response middleware (for say debug logging) in the on_complete the response details (status, headers, body etc.) are missing.
on_complete
For example the middleware below (the response logger that ships with faraday gives me the same results)
def call(env) info "#{env.method} #{env.url.to_s}" debug('request') { dump_headers env.request_headers } debug('request') { dump_body(env[:body]) } if env[:body] && log_body?(:request) @app.call(env).on_complete do |response_env| info('Status') { response_env.status.to_s } debug('response') { dump_headers response_env.response_headers } debug('response') { dump_body response_env[:body] } if env[:body] && log_body?(:response) end end
When a Dwolla request is ran response_env.response_headers is nil and the response_env.body is actually the request body.
response_env.response_headers
nil
response_env.body
I've used this type of response middleware logging before (with other faraday setups) without issue and it's very helpful for debugging requests.
When using faraday response middleware (for say debug logging) in the
on_complete
the response details (status, headers, body etc.) are missing.For example the middleware below (the response logger that ships with faraday gives me the same results)
When a Dwolla request is ran
response_env.response_headers
isnil
and theresponse_env.body
is actually the request body.I've used this type of response middleware logging before (with other faraday setups) without issue and it's very helpful for debugging requests.