Class: PartyFoul::IssueRenderers::Rack

Inherits:
Base
  • Object
show all
Defined in:
lib/party_foul/issue_renderers/rack.rb

Direct Known Subclasses

Rails

Instance Attribute Summary

Attributes inherited from Base

#env, #exception, #sha

Instance Method Summary collapse

Methods inherited from Base

#body, #body_options, #build_table_from_hash, #comment, #fingerprint, #initialize, #labels, #occurred_at, #rows_for_table_from_hash, #stack_trace, #title, #update_body

Constructor Details

This class inherits a constructor from PartyFoul::IssueRenderers::Base

Instance Method Details

#comment_optionsObject



9
10
11
# File 'lib/party_foul/issue_renderers/rack.rb', line 9

def comment_options
  super.merge(URL: url, Params: params, Session: session, 'IP Address' => ip_address_locator, 'HTTP Headers' => http_headers)
end

#http_headersHash

HTTP Headers hash from the request. Headers can be filtered out by adding matching key names to PartyFoul.blacklisted_headers

Returns:

  • (Hash)


42
43
44
45
46
47
48
49
# File 'lib/party_foul/issue_renderers/rack.rb', line 42

def http_headers
  {
    Version: env['HTTP_VERSION'], 
    'User Agent' => request.user_agent, 
    'Accept Encoding' => env['HTTP_ACCEPT_ENCODING'], 
    Accept: env['HTTP_ACCEPT'], 
  }
end

#ip_address_locatorString

Link to IP address geolocator of the client who triggered the exception

Returns:

  • (String)


23
24
25
# File 'lib/party_foul/issue_renderers/rack.rb', line 23

def ip_address_locator
  "<a href='http://ipinfo.io/#{request.ip}'>#{request.ip}</a>"
end

#paramsHash

Rack params

Returns:

  • (Hash)


16
17
18
# File 'lib/party_foul/issue_renderers/rack.rb', line 16

def params
  request.params
end

#requestObject



5
6
7
# File 'lib/party_foul/issue_renderers/rack.rb', line 5

def request
  @request ||= ::Rack::Request.new(env)
end

#sessionHash

The session hash for the client at the time of the exception

Returns:

  • (Hash)


34
35
36
# File 'lib/party_foul/issue_renderers/rack.rb', line 34

def session
  request.session
end

#urlObject



27
28
29
# File 'lib/party_foul/issue_renderers/rack.rb', line 27

def url
  "[#{request.request_method}] #{env['REQUEST_URI']}"
end