Sha256: b022af1b7a2ff8890ab33537480ad3eb3da169977ff2c8fa3e4f0dae5de131f4
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
require 'raven/interfaces' module Raven class HttpInterface < Interface name 'sentry.interfaces.Http' property :url, :required => true property :method, :required => true property :data property :query_string property :cookies property :headers, :default => {} property :env, :default => {} def from_rack(env) require 'rack' req = ::Rack::Request.new(env) self.url = req.url.split('?').first self.method = req.request_method self.query_string = req.query_string env.each_pair do |key, value| next unless key.upcase == key # Non-upper case stuff isn't either if key.start_with?('HTTP_') # Header http_key = key[5..key.length-1].split('_').map{|s| s.capitalize}.join('-') self.headers[http_key] = value.to_s else # Environment self.env[key] = value.to_s end end self.data = if req.form_data? req.POST elsif req.body data = req.body.read req.body.rewind data end end end register_interface :http => HttpInterface end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sentry-raven-0.2 | lib/raven/interfaces/http.rb |
sentry-raven-0.1 | lib/raven/interfaces/http.rb |