lib/airbrake/sender.rb in airbrake-4.3.0 vs lib/airbrake/sender.rb in airbrake-4.3.1
- old
+ new
@@ -49,11 +49,11 @@
def send_to_airbrake(notice)
data = prepare_notice(notice)
http = setup_http_connection
response = begin
- http.post(url.respond_to?(:path) ? url.path : url,
+ http.post(request_uri,
data,
headers)
rescue *HTTP_ERRORS => e
log :level => :error,
:message => "Unable to contact the Airbrake server. HTTP Error=#{e}"
@@ -173,9 +173,16 @@
end
def json_api_enabled?
!!(host =~ /collect.airbrake.io/) &&
project_id =~ /\S/
+ end
+
+ # Use request_uri[0] to keep the query since it contains the API_KEY.
+ #
+ # [0] http://ruby-doc.org/stdlib-2.2.2/libdoc/uri/rdoc/URI/HTTP.html#method-i-request_uri
+ def request_uri
+ url.respond_to?(:request_uri) ? url.request_uri : url
end
end
class CollectingSender < Sender
# Used when test mode is enabled, to store the last XML notice locally