Created
November 13, 2015 16:20
-
-
Save benzittlau/4895da8c7be5a95a4949 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Net | |
class HTTP | |
def request_with_monitor(request, body = nil, &block) | |
# Continue with the original request | |
response = request_without_monitor(request, body, &block) | |
begin | |
::NetNanny::HttpNetMonitor.output_request_debug_info(self, request) | |
if ::NetNanny::Registry.instance.registered_address?(self.address) | |
::NetNanny::Registry.instance.respond_to(self, request, response) | |
end | |
::NetNanny::Registry.instance.respond_for_all_urls(self, request, response) | |
::NetNanny::HttpNetMonitor.output_response_debug_info(self, request, response) | |
rescue => ex | |
Rails.logger.warn "Error processing request monitor - #{ex.message}" | |
end | |
response | |
end | |
alias_method :request_without_monitor, :request | |
alias_method :request, :request_with_monitor | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment