lib/appsignal/transmitter.rb in appsignal-0.11.8.beta.3 vs lib/appsignal/transmitter.rb in appsignal-0.11.8.beta.4

- old
+ new

@@ -39,24 +39,26 @@ :gem_version => Appsignal::VERSION }) end end + # Accepts a string or `Appsignal::ZippedPayload` + # If no `Appsignal::ZippedPayload` is given, it will convert it to one. def transmit(payload) + unless payload.is_a?(Appsignal::ZippedPayload) + payload = Appsignal::ZippedPayload.new(payload) + end Appsignal.logger.debug "Transmitting payload to #{uri}" http_client.request(http_post(payload)).code end protected def http_post(payload) Net::HTTP::Post.new(uri.request_uri).tap do |request| request['Content-Type'] = CONTENT_TYPE request['Content-Encoding'] = CONTENT_ENCODING - request.body = Zlib::Deflate.deflate( - JSON.generate(payload, :quirks_mode => true), - Zlib::BEST_SPEED - ) + request.body = payload.body end end def http_client Net::HTTP.new(uri.host, uri.port).tap do |http|