Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ The `payload` is a `Hash` with the following keys:

* `method` as a `Symbol`
* `request_uri` as a `String`
* `request_body` as a `String`
* `result` as an `Net::HTTPResponse`

## License
Expand Down
7 changes: 4 additions & 3 deletions lib/active_resource/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ def head(path, headers = {})
# Makes a request to the remote service.
def request(method, path, *arguments)
result = ActiveSupport::Notifications.instrument("request.active_resource") do |payload|
payload[:method] = method
payload[:request_uri] = "#{site.scheme}://#{site.host}:#{site.port}#{path}"
payload[:result] = http.send(method, path, *arguments)
payload[:method] = method
payload[:request_uri] = "#{site.scheme}://#{site.host}:#{site.port}#{path}"
payload[:request_body] = arguments[0] if Object.const_get("Net::HTTP::#{method.capitalize}::REQUEST_HAS_BODY")
payload[:result] = http.send(method, path, *arguments)
end
handle_response(result)
rescue Timeout::Error => e
Expand Down