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

#body, #env, #exception, #sha

Instance Method Summary collapse

Methods inherited from Base

#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



7
8
9
# File 'lib/party_foul/issue_renderers/rack.rb', line 7

def comment_options
  super.merge(URL: url, Params: params, Session: session, 'IP Address' => ip_address, '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)


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

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

#ip_addressString

IP address of the client who triggered the exception

Returns:

  • (String)


21
22
23
# File 'lib/party_foul/issue_renderers/rack.rb', line 21

def ip_address
  request.ip
end

#paramsHash

Rack params

Returns:

  • (Hash)


14
15
16
# File 'lib/party_foul/issue_renderers/rack.rb', line 14

def params
  request.params
end

#requestObject



3
4
5
# File 'lib/party_foul/issue_renderers/rack.rb', line 3

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

#sessionHash

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

Returns:

  • (Hash)


32
33
34
# File 'lib/party_foul/issue_renderers/rack.rb', line 32

def session
  request.session
end

#urlObject



25
26
27
# File 'lib/party_foul/issue_renderers/rack.rb', line 25

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