# class Raven::Transports::HTTP

### Attributes

adapter[RW]
conn[RW]

### Public Class Methods

new(*args) click to toggle source
Calls superclass method Raven::Transports::Transport.new

    # File lib/raven/transports/http.rb, line 11
    def initialize(*args)
      super
      self.adapter = configuration.http_adapter || Faraday.default_adapter
      self.conn = set_conn
    end

### Public Instance Methods

send_event(auth_header, data, options = {}) click to toggle source

    # File lib/raven/transports/http.rb, line 17
    def send_event(auth_header, data, options = {})
      unless configuration.sending_allowed?
        logger.debug("Event not sent: #{configuration.error_messages}")
      end

      project_id = configuration[:project_id]
      path = configuration[:path] + "/"

      conn.post "#{path}api/#{project_id}/store/" do |req|
        req.headers['Content-Type'] = options[:content_type]
        req.headers['X-Sentry-Auth'] = auth_header
        req.body = data
      end
    rescue Faraday::Error => ex
      error_info = ex.message
      if ex.response && ex.response[:headers]['x-sentry-error']
        error_info += " Error in headers is: #{ex.response[:headers]['x-sentry-error']}"
      end
      raise Raven::Error, error_info
    end