class Sqreen::Kit::Signals::Context::HttpContext

Constants

PARAMS_ATTRS
SCHEMA_VERSION

Attributes

content_length[RW]

Response content length @return [Integer]

content_type[RW]

Response content type @return [String]

datadog_span_id[RW]

Datadog span id @return [Integer]

datadog_trace_id[RW]

Datadog trace id @return [Integer]

endpoint[RW]

@return [String]

headers[RW]

mandatory @return [Array<Array<String>>] inner arrays have two values: [name, value]

host[RW]

mandatory Host header; may include the port @return [String]

params_cookies[RW]

@return [Hash]

params_form[RW]

@return [Hash]

params_json[RW]

@return [Hash]

params_other[RW]

@return [Hash]

params_query[RW]

@return [Hash]

path[RW]

mandatory XXX: Unclear is decoded or not @return [String]

port[RW]

mandatory @return [Integer|String]

referer[RW]

@return [String]

remote_ip[RW]

mandatory @return [String]

remote_port[RW]

mandatory @return [Integer|String]

reveal_replayed[RW]

@return [Boolean]

rid[RW]

@return [String]

scheme[RW]

mandatory @return [String]

status[RW]

Response status @return [Integer]

user_agent[RW]

mandatory @return [String]

verb[W]

mandatory @param [String]

Public Instance Methods

to_h() click to toggle source
# File lib/sqreen/kit/signals/context/http_context.rb, line 118
def to_h
  check_mandatories

  {
    request: compact_hash({
                            rid: rid,
                            headers: headers,
                            user_agent: user_agent,
                            scheme: scheme,
                            verb: verb,
                            host: host,
                            port: port,
                            remote_ip: remote_ip,
                            remote_port: remote_port,
                            path: path,
                            referer: referer,
                            parameters: compact_hash({
                                                       query: params_query,
                                                       form: params_form,
                                                       cookies: params_cookies,
                                                       json: params_json,
                                                       other: params_other,
                                                     }),
                            endpoint: endpoint,
                            # yes, this one is in CamelCase
                            isRevealReplayed: reveal_replayed,
                          }),
    response: compact_hash({
                             status: status,
                             content_type: content_type,
                             content_length: content_length,
                           }),
  }.merge!(compact_hash(
             datadog_trace_id: datadog_trace_id,
             datadog_span_id: datadog_span_id,
  ))
end
verb() click to toggle source
# File lib/sqreen/kit/signals/context/http_context.rb, line 47
def verb
  raise 'verb not set' unless defined?(@verb) && @verb
  @verb.upcase
end