23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/actionhook/core/net_http_sender.rb', line 23
def self.send(request, configuration = ActionHook.configuration)
ActionHook.logger.info "[ActionHook] Send called for #{request.method.upcase} to #{request.uri}"
ActionHook.logger.debug "[ActonHook] Using configuration: #{configuration.inspect}"
ActionHook.logger.debug "[ActonHook] using net/http options #{configuration.net_http_options}"
verify_allowed!(configuration, request.uri.host)
ActionHook.logger.debug "[ActonHook] #{request.uri.host} is clear, not blocked"
options = { use_ssl: request.uri.scheme == 'https' }.merge(configuration.net_http_options)
Net::HTTP.start(request.uri.host, request.uri.port, options) do |http|
http_request = request_method_class(request.method).new request.uri
http_request.body = request.serialized_body if request.body
ActionHook.logger.debug "[ActonHook] Body: #{http_request.body}"
request.(configuration)&.each_pair do |name, value|
ActionHook.logger.debug "[ActonHook] Added Security Header: #{name}"
http_request[name] = value.to_s
end
http.request http_request
end
end
|